Having issue clearing button colors... will try new DL and see if that is the fix!
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Button_8
#Button_7
#Button_6
#Button_5
#Button_4
#Button_3
#Button_2
#Button_1
#Button_0
#Text_MSG
EndEnumeration
Structure VisualDesignerGadgets
Gadget.l
EventFunction.l
EndStructure
Global NewList EventProcedures.VisualDesignerGadgets()
;-
Procedure Whichbutton(button)
For XX = #Button_8 To #Button_0
PureCOLOR_ClearButtonColor(XX)
Next
PureCOLOR_SetButtonColor(button, RGB(255, 255, 255), RGB(0, 0, 0))
EndProcedure
;-
Procedure Button_8_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_8)
EndProcedure
Procedure Button_7_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_7)
EndProcedure
Procedure Button_6_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_6)
EndProcedure
Procedure Button_5_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_5)
EndProcedure
Procedure Button_4_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_4)
EndProcedure
Procedure Button_3_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_3)
EndProcedure
Procedure Button_2_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_2)
EndProcedure
Procedure Button_1_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_1)
EndProcedure
Procedure Button_0_Event(Window, Event, Gadget, Type)
Whichbutton(#Button_0)
EndProcedure
;-
Procedure RegisterGadgetEvent(Gadget, *Function)
If IsGadget(Gadget)
AddElement(EventProcedures())
EventProcedures()\Gadget = Gadget
EventProcedures()\EventFunction = *Function
EndIf
EndProcedure
Procedure CallEventFunction(Window, Event, Gadget, Type)
ForEach EventProcedures()
If EventProcedures()\Gadget = Gadget
CallFunctionFast(EventProcedures()\EventFunction, Window, Event, Gadget, Type)
LastElement(EventProcedures())
EndIf
Next
EndProcedure
;-
Procedure Open_Window_0()
If OpenWindow(#Window_0, 5, 5, 248, 441, "BUTON TESTER", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
ButtonGadget(#Button_0, 5, 5, 235, 40, "BUTTON 0")
RegisterGadgetEvent(#Button_0, @Button_0_Event())
ButtonGadget(#Button_1, 5, 50, 235, 40, "BUTTON 1")
RegisterGadgetEvent(#Button_1, @Button_1_Event())
ButtonGadget(#Button_2, 5, 95, 235, 40, "BUTTON 2")
RegisterGadgetEvent(#Button_2, @Button_2_Event())
ButtonGadget(#Button_3, 5, 140, 235, 40, "BUTTON 3")
RegisterGadgetEvent(#Button_3, @Button_3_Event())
ButtonGadget(#Button_4, 5, 185, 235, 40, "BUTTON 4")
RegisterGadgetEvent(#Button_4, @Button_4_Event())
ButtonGadget(#Button_5, 5, 230, 235, 40, "BUTTON 5")
RegisterGadgetEvent(#Button_5, @Button_5_Event())
ButtonGadget(#Button_6, 5, 275, 235, 40, "BUTTON 6")
RegisterGadgetEvent(#Button_6, @Button_6_Event())
ButtonGadget(#Button_7, 5, 320, 235, 40, "BUTTON 7")
RegisterGadgetEvent(#Button_7, @Button_7_Event())
ButtonGadget(#Button_8, 5, 365, 235, 40, "BUTTON 8")
RegisterGadgetEvent(#Button_8, @Button_8_Event())
TextGadget(#Text_MSG, 5, 410, 235, 25, "", #PB_Text_Center | #PB_Text_Border)
EndIf
EndProcedure
;-
Open_Window_0()
PureCOLOR_SetButtonColor(#Button_0, RGB(255, 255, 255), RGB(0, 0, 0))
Repeat
Event = WaitWindowEvent()
Gadget = EventGadget()
Type = EventType()
Window = EventWindow()
Select Event
Case #PB_Event_Gadget
CallEventFunction(Window, Event, Gadget, Type)
EndSelect
Until Event = #PB_Event_CloseWindow
End
This code SHOULD uncolor all the buttons and then slap the color on the selectted button... instead it simply colors the new button as well...
is not an option in my program as I have MANY buttons in my POS... in PB4.3 this code works... I suspect it is a PB4.41 issue!