Listicon: Anchor the first column (Updated April 24, 2010)
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
hehe, there is a complaint! If you scroll the horizontal bar over, then resize the column, you get an undesirable effect. This is because of the way I'm grabbing the button image, the DC has to be fully scrolled right to correctly get the image. If it isn't, it gets part of button 0 and part of button 1, etc. I am fully reworking this right now as part of the process of making button 0 pressable. Much better thing to come.
BERESHEIT
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
A clever way of getting the 3 button images netmaestro; very slick!
Did you look at the uxTheme library as an alternative though - I presume you can render these images directly through this library (although I haven't checked this!) Hey, column 0 no longer jumps when you resize it! Yes, much better.
A couple of minor glitches. With full row select, the text in the selected row in column 0 is black rather than the system highlight-text color. Looks a bit odd. Also, when the listicon loses focus, all cells in the selcted row lose the highlighted background, except column 0. Finally, switch off xp themes and the whole of column 0 has a gray background! Perhaps some of this is just Vista only.
Thanks again.


A couple of minor glitches. With full row select, the text in the selected row in column 0 is black rather than the system highlight-text color. Looks a bit odd. Also, when the listicon loses focus, all cells in the selcted row lose the highlighted background, except column 0. Finally, switch off xp themes and the whole of column 0 has a gray background! Perhaps some of this is just Vista only.
Thanks again.
I may look like a mule, but I'm not a complete ass.
Re: Listicon: Anchor the first column (Updated Sun. March 29

it seems don't release resources
Test Code:
Code: Select all
IncludeFile "fixedicongadget.pbi"
OpenWindow(0,0,0,400,300,"FixedIconGadget Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
FixedIconGadget(0,10,10,380,280,"column 0", 140,#PB_ListIcon_FullRowSelect)
FreeGadget(0)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
QuimV
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Listicon: Anchor the first column (Updated Sun. March 29
I'll look at it later today, I'm very busy sorry.
BERESHEIT
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Listicon: Anchor the first column (Updated Sun. March 29
Update 24 April 2010: Corrected bugs preventing the gadget from responding to FreeGadget() properly. The gadget is freed completely now when it receives this command.
BERESHEIT
Re: Listicon: Anchor the first column (Updated April 24, 201
Nice. 

I may look like a mule, but I'm not a complete ass.
Re: Listicon: Anchor the first column (Updated April 24, 201
@netmaestro,
Tested on WXPSP3+PB441 - WXPSP3+PB450B3 - W732+PB441 - W732+PB450 and all runs fine.
Thanks a lot

Thanks a lot
QuimV
Re: Listicon: Anchor the first column (Updated April 24, 201
First post here, so hi everyone.
I am writing a program in PB and have come to the stage where I need a ListIconGadget. This works fine for my purposes and I have no complaints, but I have been looking for a simple way to lock the first column.
This works fine using the code here, until I want to resize the ListIconGadget. It seems that it does not redraw properly. I changed the example provided to show the problem. Try resizing the window.
Does anyone know a fix for this so that I can lock the first column and dynamically resize the ListIconGadget based on the window size.
Thanks in advance for any help.

I am writing a program in PB and have come to the stage where I need a ListIconGadget. This works fine for my purposes and I have no complaints, but I have been looking for a simple way to lock the first column.
This works fine using the code here, until I want to resize the ListIconGadget. It seems that it does not redraw properly. I changed the example provided to show the problem. Try resizing the window.
Does anyone know a fix for this so that I can lock the first column and dynamically resize the ListIconGadget based on the window size.
Thanks in advance for any help.
Code: Select all
Global old_proc
Procedure MyListProc(hwnd, msg, wparam, lparam)
Select msg
Case #WM_NOTIFY
*nmHEADER.HD_NOTIFY = lParam
Select *nmHEADER\hdr\code
Case #HDN_ITEMCLICKW
Debug "Column "+Str(*nmHEADER\iitem)+" button pressed"
EndSelect
EndSelect
ProcedureReturn CallWindowProc_(old_proc, hwnd, msg, wparam, lparam)
EndProcedure
OpenWindow(0,0,0,200,200,"FixedIconGadget Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu| #PB_Window_SizeGadget)
List0 = FixedIconGadget(#PB_Any,10,10,600,300,"column 0", 140,#PB_ListIcon_FullRowSelect)
ResizeGadget(List0, 20,100,#PB_Ignore,600)
SetGadgetFont(List0, LoadFont(0, "Arial", 12) )
AddGadgetColumn(List0,1,"Column 1",100)
AddGadgetColumn(List0,2,"Column 2",100)
AddGadgetColumn(List0,3,"Column 3",100)
AddGadgetColumn(List0,4,"Column 4",100)
AddGadgetColumn(List0,5,"Column 5",100)
AddGadgetColumn(List0,6,"Column 6",100)
AddGadgetColumn(List0,7,"Column 7",100)
For i=0 To 100
AddGadgetItem(List0, -1, "Line "+Str(i)+" First gadget column 0"+Chr(10)+"Line "+Str(i)+" col 1"+Chr(10)+"Line "+Str(i)+" col 2"+Chr(10)+"Line "+Str(i)+" col 3"+Chr(10)+"Line "+Str(i)+" col 4"+Chr(10)+"Line "+Str(i)+" col 5"+Chr(10)+"Line "+Str(i)+" col 6"+Chr(10)+"Line "+Str(i)+" col 7")
Next
old_proc = SetWindowLong_(GadgetID(list0),#GWL_WNDPROC,@MyListProc())
;ButtonGadget(0, 400,720,100,20,"Destroy")
Repeat
ev = WaitWindowEvent()
Select ev
Case #PB_Event_Gadget
If EventGadget()=0
FreeGadget(List0)
EndIf
Case #PB_Event_SizeWindow
ResizeGadget(List0,0,0,WindowWidth(0),WindowHeight(0))
EndSelect
Until ev = #PB_Event_CloseWindow
Re: Listicon: Anchor the first column (Updated April 24, 201
I tried for many hours to get this code working with dynamic resizing, but never had any success. I'm assuming it's not possible without big changes.
Anyway, I worked around this issue for my own program by using a pair of standard ListIconGadgets. The first one has column 1, and the second one has the rest of the columns. Then I used a callback to synchronize the vertical scrolling. Each ListIconGadget is sitting on a ContainerGadget and the position/size is adjusted in such a way that the first ListIconGadget vertical scroll bar is hidden. Then I wrote a bunch of wrapper functions for moving, resizing, changing colours, setting and retrieving items, etc...
Not the cleanest way of doing it but it works well enough for what I need to do.
I am happy to share my code if requested, but I don't want to derail this thread as my idea is completely different to what is presented in here.
Thanks anyway.
Anyway, I worked around this issue for my own program by using a pair of standard ListIconGadgets. The first one has column 1, and the second one has the rest of the columns. Then I used a callback to synchronize the vertical scrolling. Each ListIconGadget is sitting on a ContainerGadget and the position/size is adjusted in such a way that the first ListIconGadget vertical scroll bar is hidden. Then I wrote a bunch of wrapper functions for moving, resizing, changing colours, setting and retrieving items, etc...
Not the cleanest way of doing it but it works well enough for what I need to do.
I am happy to share my code if requested, but I don't want to derail this thread as my idea is completely different to what is presented in here.
Thanks anyway.
