Hi All,
Is there any way to align (JUSTIFY) the 1st column of a grid to right-aligned?
Thanks in advance.
With best regards.
Sudip
Alignment of 1st column of Grid
Moderator: Rathinagiri
Alignment of 1st column of Grid
With best regards,
Sudip
Sudip
Re: Alignment of 1st column of Grid
Hello Sudip,sudip wrote:Hi All,
Is there any way to align (JUSTIFY) the 1st column of a grid to right-aligned?
In the official HMG:
You can define the 1st column of a grid with a zero length and place the 'Salary' item in the second column.
In the HMG Extended:
We have a hack in the C-function INITLISTVIEWCOLUMNS (borrowed from ooHG) for aligning the 1st column of a grid
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Rathinagiri
- Posts: 5481
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Alignment of 1st column of Grid
Nice n simple solution.You can define the 1st column of a grid with a zero length and place the 'Salary' item in the second column.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Alignment of 1st column of Grid
Thanks a lot Grigory. It works!
With best regards.
Sudip
With best regards.
Sudip
With best regards,
Sudip
Sudip
- Roberto Lopez
- HMG Founder
- Posts: 4023
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Alignment of 1st column of Grid
There is known limitation of ListView Windows control about that.gfilatov wrote: In the HMG Extended:
We have a hack in the C-function INITLISTVIEWCOLUMNS (borrowed from ooHG) for aligning the 1st column of a grid
Could be you so kind to post that hack here to review it?
TIA.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Alignment of 1st column of Grid
Hi Roberto,Roberto Lopez wrote:There is known limitation of ListView Windows control about that.gfilatov wrote: In the HMG Extended:
We have a hack in the C-function INITLISTVIEWCOLUMNS (borrowed from ooHG) for aligning the 1st column of a grid
Could be you so kind to post that hack here to review it?
Sure. Please take a look for code below:
Code: Select all
/* code of the function INITLISTVIEWCOLUMNS is borrowed from ooHG */
HB_FUNC( INITLISTVIEWCOLUMNS )
{
PHB_ITEM wArray;
PHB_ITEM hArray;
PHB_ITEM jArray;
HWND hc;
LV_COLUMN COL;
int iLen;
int s;
int iColumn = 0;
hc = ( HWND ) hb_parnl( 1 );
iLen = hb_parinfa( 2, 0 ) - 1;
hArray = hb_param( 2, HB_IT_ARRAY );
wArray = hb_param( 3, HB_IT_ARRAY );
jArray = hb_param( 4, HB_IT_ARRAY );
COL.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
for( s = 0; s <= iLen; s++ )
{
COL.fmt = hb_arrayGetNI( jArray, s + 1 );
COL.cx = hb_arrayGetNI( wArray, s + 1 );
COL.pszText = (char *) hb_arrayGetCPtr( hArray, s + 1 );
COL.iSubItem = iColumn;
ListView_InsertColumn( hc, iColumn, &COL );
if( iColumn == 0 && COL.fmt != LVCFMT_LEFT )
{
iColumn++;
COL.iSubItem = iColumn;
ListView_InsertColumn( hc, iColumn, &COL );
}
iColumn++;
}
if( iColumn != s )
{
ListView_DeleteColumn( hc, 0 ); // <-- this hack
}
}
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Roberto Lopez
- HMG Founder
- Posts: 4023
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Alignment of 1st column of Grid
Many thanks.gfilatov wrote: Hi Roberto,
Sure. Please take a look for code below:![]()
<...>
I'll do it ASAP.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)