Grid header

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Grid header

Post by mlnr »

Hi all,

1.
How can change a grid's header property with SetProperty?

Code: Select all

Form_1.Grid_1.Header(1) := "New Header"  //works
SetProperty("Form_1","Grid_1","Header(1)","New Header")  //not works
2.
Is it possible to change an active grid's columnfields value?
Best regards,
Gabor
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Grid header

Post by AUGE_OHR »

mlnr wrote: Tue Feb 18, 2020 3:19 pm Hi all,

1.
How can change a grid's header property with SetProperty?

Code: Select all

Form_1.Grid_1.Header(1) := "New Header"  //works
SetProperty("Form_1","Grid_1","Header(1)","New Header")  //not works
2.
Is it possible to change an active grid's columnfields value?
ad 1.) there is in c:\hmg.3.4.4\SOURCE\c_grid.c

Code: Select all

HB_FUNC ( SETGRIDCOLOMNHEADER )
{
	LV_COLUMN COL;
	COL.mask = LVCF_TEXT ;
	COL.pszText= (TCHAR*)HMG_parc(3) ;
	ListView_SetColumn ( (HWND) HMG_parnl (1), hb_parni ( 2 ) - 1 , &COL );
}
so you need handle of Grid to set new Grid-Header

Code: Select all

   hGrid := GetControlHandle( cGrid, cForm )
   SETGRIDCOLOMNHEADER(hGrid, nCol, cText)

ad 2.)
do you want to "edit Cell" :?:
if yes look at GRID -> [ EDIT | ALLOWEDIT ] and "Properties Available For OnDblClick Procedure:"
have fun
Jimmy
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Grid header

Post by edk »

mlnr wrote: Tue Feb 18, 2020 3:19 pm Hi all,

1.
How can change a grid's header property with SetProperty?

Code: Select all

Form_1.Grid_1.Header(1) := "New Header"  //works
SetProperty("Form_1","Grid_1","Header(1)","New Header")  //not works

Code: Select all

SetProperty("Form_1","Grid_1","Header", 1, "New Header")  
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: Grid header

Post by mlnr »

do you want to "edit Cell" :?:
if yes look at GRID -> [ EDIT | ALLOWEDIT ] and "Properties Available For OnDblClick Procedure:"
Hi Jimmy,

I would like to replace the ROWSOURCE's one field to another, after acivated the GRID control and before edit the Cell.

eg. this control activated

Code: Select all

@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5','Column 6'} ;
WIDTHS {140,140,140,100,100,100};
EDIT ;
VALUE { 1 , 1 } ;
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 , aCtrl_3 , aCtrl_4 , aCtrl_5 , aCtrl_6 } ;
ROWSOURCE "Test" ;
COLUMNFIELDS { 'Code' ,  'First' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
ALLOWAPPEND ;
ALLOWDELETE  
And i'd like to change the order after acivated. Change the 'First' field to 'Code' field.

Code: Select all

COLUMNFIELDS { 'First' ,  'Code' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
Best regards,
Gabor
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: Grid header

Post by mlnr »

Code: Select all

SetProperty("Form_1","Grid_1","Header", 1, "New Header")  

Hello Edward,

Thank you so much, it works. :)
Best regards,
Gabor
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Grid header

Post by AUGE_OHR »

mlnr wrote: Wed Feb 19, 2020 8:17 am I would like to replace the ROWSOURCE's one field to another, after acivated the GRID control and before edit the Cell.

eg. this control activated

Code: Select all

COLUMNFIELDS { 'Code' ,  'First' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
And i'd like to change the order after acivated. Change the 'First' field to 'Code' field.

Code: Select all

COLUMNFIELDS { 'First' ,  'Code' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
Ok, understand.
i know there is a Listview Macro to "move Column" but i have to search for it.
not sure if it will work when "data-bound" like in HMG
have fun
Jimmy
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Grid header

Post by edk »

mlnr wrote: Wed Feb 19, 2020 8:17 am I would like to replace the ROWSOURCE's one field to another, after acivated the GRID control and before edit the Cell.

Code: Select all

COLUMNFIELDS { 'Code' ,  'First' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
And i'd like to change the order after acivated. Change the 'First' field to 'Code' field.

Code: Select all

COLUMNFIELDS { 'First' ,  'Code' , 'Last' ,  'Birth' , 'Married' , 'Bio' } ;
Look at: <ParentWindowName>.<GridControlName>.ColumnDISPLAYPOSITION ( nColIndex ) := nColumnDisplayPosition
Sample: c:\hmg.3.4.4\SAMPLES\Controls\Grid\GRID_Column_Order\demo.prg
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: Grid header

Post by mlnr »

Look at: <ParentWindowName>.<GridControlName>.ColumnDISPLAYPOSITION ( nColIndex ) := nColumnDisplayPosition
Sample: c:\hmg.3.4.4\SAMPLES\Controls\Grid\GRID_Column_Order\demo.prg

Thank you again for your help. :)
Best regards,
Gabor
Post Reply