List Icon Gadget: force number of columns
Posted: Mon Apr 23, 2012 6:44 pm
Scenario: You have a form with a ListIcon Gadget that has n Columns (say 0,1,2) and the Gadget is nailed to the form so that it will resize with it (I use gonzal's PureRESIZE lib).
The snag is that, when you drag the Window size out to the right, "column 3" is stretched to suit, rather than a column you are actually using. Is there a way around that conundrum?
The snag is that, when you drag the Window size out to the right, "column 3" is stretched to suit, rather than a column you are actually using. Is there a way around that conundrum?
Code: Select all
#Win = 0
#ListIcon = 1
Procedure OpenWin()
;------------------
If OpenWindow(#Win, 100, 100, 400, 300,"4th Column",#PB_Window_SizeGadget|#PB_Window_SystemMenu|#PB_Window_TitleBar)
ListIconGadget(#ListIcon,10,25,380,250,"Col 0", 80,#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
AddGadgetColumn(#ListIcon, 1, "Col 1", 150)
AddGadgetColumn(#ListIcon, 2, "Col 2", 150)
; Gadget Resizing
PureRESIZE_SetGadgetResize(#ListIcon, 1, 1, 1, 1)
SendMessage_(GadgetID(#ListIcon), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_GRIDLINES, #LVS_EX_GRIDLINES)
EndIf
EndProcedure
OpenWin()
Repeat
iEvent = WaitWindowEvent(1)
Until iEvent = #PB_Event_CloseWindow
CloseWindow(#Win)
End