Page 1 of 1

1st column justification in the grid

Posted: Sun Apr 25, 2010 9:27 am
by Czarny_Pijar
Working example and picture here viewtopic.php?f=15&t=1366 ;)
The first column in the grid is intended to be centered, alas remains left-aligned .

Re: 1st column justification in the grid

Posted: Sun Apr 25, 2010 9:43 am
by esgici
Czarny_Pijar wrote: The first column in the grid is intended to be centered, alas remains left-aligned .
Hi Czarny

HMG Reference wrote:- The leftmost column in a grid control must be left aligned.
Regards

--

Esgici

Re: 1st column justification in the grid

Posted: Sun Apr 25, 2010 11:38 am
by Roberto Lopez
Czarny_Pijar wrote:Working example and picture here viewtopic.php?f=15&t=1366 ;)
The first column in the grid is intended to be centered, alas remains left-aligned .
As Esgici said, this is clarified in the reference.

This is a limitation inherited from Windows ListView control.

The trick to workaround this, is to create a first column with 0 width. So, the first visible column will be the second, that could be aligned as you wish.

Re: 1st column justification in the grid

Posted: Sun Apr 25, 2010 1:09 pm
by gfilatov
Czarny_Pijar wrote:Working example and picture here viewtopic.php?f=15&t=1366 ;)
The first column in the grid is intended to be centered, alas remains left-aligned .
Hi Czarny,

Please take a look for the following interesting thread with a small trick:
viewtopic.php?f=5&t=1124#p7836

Hope that helps :idea:

Re: 1st column justification in the grid

Posted: Sun Apr 25, 2010 1:33 pm
by Czarny_Pijar
Thank you all and sorry for the mess.
Next time before posting I will check at least the earlier posts for the existng solutions.

Re: 1st column justification in the grid

Posted: Sun Apr 25, 2010 5:40 pm
by Roberto Lopez
gfilatov wrote:
Czarny_Pijar wrote:Working example and picture here viewtopic.php?f=15&t=1366 ;)
The first column in the grid is intended to be centered, alas remains left-aligned .
Hi Czarny,

Please take a look for the following interesting thread with a small trick:
viewtopic.php?f=5&t=1124#p7836

Hope that helps :idea:
Thanks for remember us that.

I'll must test and analyze the code yet to consider its inclusion in HMG.

Re: 1st column justification in the grid

Posted: Mon Apr 26, 2010 12:59 am
by Roberto Lopez
gfilatov wrote:Please take a look for the following interesting thread with a small trick:
viewtopic.php?f=5&t=1124#p7836
I've not tested, but I'm pretty sure that this hack is working fine.

The hack consist of adding an extra-column, when column zero is not left-aligned and later deleting the original one (the column #0).

Code: Select all

   if( iColumn != s )
   {
      ListView_DeleteColumn( hc, 0 );       // <-- this hack
   }
The problem is that according Microsoft it can't be done :)

The following quote is from ListView_DeleteColumn macro documentation at msdn(http://msdn.microsoft.com/en-us/library ... S.85).aspx)
Column zero of the list-view control cannot be deleted.
Pretty strange... maybe I'm missing something...