IonicWind Software

IWBasic => GUI Central => Topic started by: billhsln on August 24, 2007, 04:03:34 PM

Title: Grid Lines in LISTVIEW
Post by: billhsln on August 24, 2007, 04:03:34 PM
control w1,@listview,"",10,120,screenw,200,1|@border,12
setfont w1,"Arial",12,400,0,12

SENDMESSAGE w1,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT,12:'Set full row select
SENDMESSAGE w1.hWnd,0x1036,0x1,-1,12:'Set gridlines on
SENDMESSAGE w1.hWnd,0x1024,0,0x000000,12:'Set text colour
SENDMESSAGE w1.hWnd,0x1026,0,0xF7DFD6,12:'Set text background colour
SENDMESSAGE w1.hWnd,0x1001,0,0xF7DFD6,12:'Set background colour


In the above snippet, from Brian Pugh's BookShop program, the comment on the 5th line says 'Set grildlines on'.  I can not find any where in the documentation that talks about grid lines and how to turn them on and off.  Would also like to know how to set their color.  Any help will be appreciated.

Thanks,
Bill
Title: Re: Grid Lines in LISTVIEW
Post by: LarryMc on August 24, 2007, 04:34:13 PM
CONST LVS_EX_GRIDLINES = 1

SENDMESSAGE w1,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES ,12:'Set full row select


Look at the "listview - noresize" example in the project folder.

Larry
Title: Re: Grid Lines in LISTVIEW
Post by: srod on August 24, 2007, 04:46:38 PM
SendMessage w1, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_GRIDLINES, LVS_EX_GRIDLINES, id


will turn the gridlines on,

SendMessage w1, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_GRIDLINES, 0, id


will turn them off.

As for gridline colour?  Interesting question.  Never thought about that before. With previous projects I've drawn the gridlines myself to avoid certain problems with the native gridlines which of course meant that I could choose the colour. I've never encountered an api function which will allow the colour to be changed.  I'll have a look on MSDN.
Title: Re: Grid Lines in LISTVIEW
Post by: srod on August 25, 2007, 01:10:43 PM
I just asked one of the Purebasic creators how he coloured the gridlines in the Window's ListView control.

The answer was that he custom drew them (as I have done in the past) as he could find no other way of doing it.  Believe me, if this guy could find no other way, then there is a 99.9999% chance of being no other way!  :)

Reckon you'll need to roll your sleeves up therefore and get stuck into Custom Draw methods.  It's good fun!