Code: Select all
Procedure SetBackColorAndLines(gad,color)
r=Red(color)-20 : If r<0 : r=0 : EndIf
g=Green(color)-20 : If g<0 : g=0 : EndIf
b=Blue(color)-20 : If b<0 : b=0 : EndIf
SetGadgetColor(gad,#PB_Gadget_LineColor,RGB(r,g,b))
SetGadgetColor(gad,#PB_Gadget_BackColor,color)
EndProcedure
If OpenWindow(0, 100, 100, 400, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(0, 5, 5, 390, 90, "Name", 100, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
AddGadgetColumn(0, 1, "Address", 250)
AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
;SetGadgetColor(0,#PB_Gadget_BackColor,RGB(255,225,170)) ; The usual ugly way. :(
SetBackColorAndLines(0,RGB(255,225,170)) ; The nice color-matching way. :)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
