1st column justification in the grid

Moderator: Rathinagiri

Post Reply
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

1st column justification in the grid

Post 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 .
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: 1st column justification in the grid

Post 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
Viva INTERNATIONAL HMG :D
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: 1st column justification in the grid

Post 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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
gfilatov
Posts: 1057
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: 1st column justification in the grid

Post 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:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: 1st column justification in the grid

Post 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.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: 1st column justification in the grid

Post 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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: 1st column justification in the grid

Post 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...
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply