Page 2 of 2
Posted: Sat Mar 28, 2009 6:28 pm
by netmaestro
Update March 28, code & details in first post
Posted: Sun Mar 29, 2009 5:22 pm
by srod
Very nice; co complaints this time from me!
Thanks.
Posted: Sun Mar 29, 2009 5:28 pm
by netmaestro
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.
Posted: Sun Mar 29, 2009 7:48 pm
by netmaestro
Update March 29, details & code in first post. Also, the demo prog is updated to test button presses for column 0.
Posted: Mon Mar 30, 2009 4:34 am
by netmaestro
Just tried this with gnozal's PureLVSort library, seems to work fine! (whew)
After I add support for #PB_ListIcon_Gridlines I'm going to call this pretty much done, unless I'm missing something.
Posted: Mon Mar 30, 2009 12:02 pm
by srod
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.
Re: Listicon: Anchor the first column (Updated Sun. March 29
Posted: Thu Apr 22, 2010 10:29 am
by QuimV
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
Re: Listicon: Anchor the first column (Updated Sun. March 29
Posted: Thu Apr 22, 2010 11:42 am
by netmaestro
I'll look at it later today, I'm very busy sorry.
Re: Listicon: Anchor the first column (Updated Sun. March 29
Posted: Thu Apr 22, 2010 1:02 pm
by QuimV

OK don't worry and Thanks
Re: Listicon: Anchor the first column (Updated Sun. March 29
Posted: Sat Apr 24, 2010 9:30 pm
by netmaestro
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.
Re: Listicon: Anchor the first column (Updated April 24, 201
Posted: Sun Apr 25, 2010 10:25 am
by srod
Nice.

Re: Listicon: Anchor the first column (Updated April 24, 201
Posted: Sun Apr 25, 2010 10:53 am
by QuimV
@netmaestro,

Tested on WXPSP3+PB441 - WXPSP3+PB450B3 - W732+PB441 - W732+PB450 and all runs fine.
Thanks a lot
Re: Listicon: Anchor the first column (Updated April 24, 201
Posted: Wed Mar 21, 2018 9:59 am
by troybowd
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.
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
Posted: Fri Mar 23, 2018 10:55 pm
by troybowd
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.
