Posted: Thu Jul 20, 2006 6:01 pm
QuimV, the code works okay here. You just have to comment out the SendMessage_() as you can't use both methods!
Code: Select all
If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If LoadFont(0, "Verdana", 8,0)
SetGadgetFont(#PB_Default, FontID(0)) ; Set the loaded Verdana 8 font as new standard
EndIf
If CreateGadgetList(WindowID(0))
ListIconGadget(0, 5, 5, 290, 90, "Name", 50, #PB_ListIcon_AlwaysShowSelection)
If StartDrawing(WindowOutput(0))
FontID.l = GetGadgetFont(0)
DrawingFont(FontID)
text_wide.l=TextWidth("Test + test + test")
StopDrawing()
Else
ancho=100
EndIf
AddGadgetColumn(0, 1,"Test + test + test", text_wide)
AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament")
AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic")
;SendMessage_(GadgetID(0), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
Debug "text_wide: " + Str(text_wide) ;pixels = 100
Debug "WindowWidth: " + Str(WindowWidth(0)) ;pixels = 300
Debug "GetGadgetItemAttribute: " + Str(GetGadgetItemAttribute(0, -1, #PB_ListIcon_ColumnWidth,1)) ;pixels = 100
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
EndIf