Error creating gadget
Posted: Mon Nov 18, 2024 10:07 am
1. Click the "Add" button, a new button will appear.
2. Start again and first click the “Properties” button, then “Add”. We get the error "There is no current GadgetList."
2. Start again and first click the “Properties” button, then “Add”. We get the error "There is no current GadgetList."
Code: Select all
; 1. Click the "Add" button, a new button will appear.
; 2. Start again and first click the “Properties” button, then “Add”. We get the error "There is no current GadgetList."
#Window = 0
#Win1 = 1
Procedure Properties()
DisableWindow(#Window, 1)
OpenWindow(#Win1, 0, 0, 200, 133, "Properties", #PB_Window_SystemMenu | #PB_Window_ScreenCentered, hGUI)
CheckBoxGadget(3, 10, 10, 180, 20, "CheckBox")
ButtonGadget(4, (200 - 70) / 2, 133 - 40, 70, 28, "OK")
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 4
Break
EndSelect
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
FreeGadget(3)
FreeGadget(4)
DisableWindow(#Window, 0)
CloseWindow(#Win1)
EndProcedure
hGUI = OpenWindow(#Window, 0, 0, 220, 300, "Example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If hGUI
ButtonGadget(1, 10, 10, 99, 30, "Properties")
ButtonGadget(2, 120, 10, 69, 30, "Add")
ButtonGadget(5, 10, 50, 26, 30, "11")
ButtonGadget(6, 50, 50, 26, 30, "22")
;- Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Properties()
Case 2
ButtonGadget(7, 166, 50, 30, 30, "33")
EndSelect
Case #PB_Event_CloseWindow
CloseWindow(#Window)
End
EndSelect
ForEver
EndIf