Set the color is also without an update. Maybe this has already been fixed...
Code:
EnableExplicitDefine i, EventGadget, EventType, icon, farbe#PB_ListIcon_ColumnAlignment = 5#PB_ListIcon_ClickedColumn = 4#PB_ListIcon_Left = 0#PB_ListIcon_Right = 1#PB_ListIcon_Center = 2#PB_EventType_ColumnClick = 7Enumeration #GID_Button_L #GID_Button_R #GID_Button_C #GID_List #GID_Button_Icon #GID_Button_ColEndEnumerationLoadImage(0, #PB_Compiler_Home+"Examples/Sources/Data/File.bmp")#WindowID = 0#list_width = 700#list_height = 300#button_height = 35#dist = 10OpenWindow(#WindowID, 200, 100, #list_width + #dist * 2, #list_height + #button_height + 3 * #dist, "Detect left click on header cell")ListIconGadget(#GID_List, #dist, #dist, #list_width, #list_height, "Column 0", 140, #PB_ListIcon_GridLines)AddGadgetColumn(#GID_List, 1, "Column 1", 80)AddGadgetColumn(#GID_List, 2, "Column 2", 300)For i = 1 To 3 AddGadgetItem(#GID_List, -1, "Harry Rannit" + #LF$ + Str(CountGadgetItems(#GID_List)) + #LF$ + "12 Parliament Way, Battle Street, By the Bay") AddGadgetItem(#GID_List, -1, "Ginger Brokeit" + #LF$ + Str(CountGadgetItems(#GID_List)) + #LF$ + "130 PureBasic Road, BigTown, CodeCity") AddGadgetItem(#GID_List, -1, "Didi Foundit" + #LF$ + Str(CountGadgetItems(#GID_List)) + #LF$ + "321 Logo Drive, Mouse House, Downtown")Next iButtonGadget(#GID_Button_Icon, #dist, GadgetHeight(#GID_List) + #dist * 2, 200, #button_height, "Icons", #PB_Button_Toggle)ButtonGadget(#GID_Button_L, 300, GadgetHeight(#GID_List) + #dist * 2, #button_height, #button_height, "L")ButtonGadget(#GID_Button_R, 300 + 50, GadgetHeight(#GID_List) + #dist * 2, #button_height, #button_height, "R")ButtonGadget(#GID_Button_C, 300 + 100, GadgetHeight(#GID_List) + #dist * 2, #button_height, #button_height, "C")ButtonGadget(#GID_Button_Col, 500, GadgetHeight(#GID_List) + #dist * 2, 200, #button_height, "Color", #PB_Button_Toggle)Repeat Select WaitWindowEvent() Case #PB_Event_CloseWindow Break Case #PB_Event_Gadget EventGadget = EventGadget() Select EventGadget Case #GID_List EventType = EventType() Select EventType Case #PB_EventType_Change Debug "select row " + Str(GetGadgetState(EventGadget)) Case #PB_EventType_ColumnClick Debug "click on header of column " + Str(GetGadgetAttribute(EventGadget, #PB_ListIcon_ClickedColumn)) EndSelect Case #GID_Button_Icon Debug "icons " + Str(GetGadgetState(#GID_Button_Icon)) For i = 1 To 6 If GetGadgetState(#GID_Button_Icon): icon = ImageID(0): Else: icon = 0: EndIf SetGadgetItemImage(#GID_List, i - 1, icon) Next i Case #GID_Button_Col Debug "color " + Str(GetGadgetState(#GID_Button_Col)) For i = 4 To 8 If GetGadgetState(#GID_Button_Col): farbe = $0000FF: Else: farbe = #PB_Default: EndIf SetGadgetItemColor(#GID_List, i, #PB_Gadget_BackColor, farbe) Next i Case #GID_Button_L, #GID_Button_R, #GID_Button_C Debug "set alignment " + Str(EventGadget) For i = 0 To 2 SetGadgetItemAttribute(#GID_List, 0, #PB_ListIcon_ColumnAlignment, EventGadget, i) Next i EndSelect EndSelectForEver
Statistics: Posted by Lebostein — Wed Dec 27, 2023 9:45 pm