How To Work Whith Checkbox Gadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
LESTROSO
Enthusiast
Enthusiast
Posts: 124
Joined: Thu Nov 03, 2005 12:30 pm
Location: Italy
Contact:

How To Work Whith Checkbox Gadget

Post by LESTROSO »

Dear friend,

I have a problem... i don't know how to use the checkboxgadget ...

the manual is poor..or perhaps i don't understand well me....

In any way i need help please...i need a little code to test and use this checkboxgadget....

I have tryed with purebasic designer, but don't work very fine..this code below is bad... but is a starting code...

can somebody help me please??

Thanks in advance,lestroso :oops:

Code: Select all

;


Global Window_0, mytest


Procedure OpenWindow_0 (x = 0, y = 0, width = 280, height = 110)
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
  Mytest = CheckBoxGadget(#PB_Any, 80, 40, 100, 25, "Mytest")
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
         Case  Mytest ; i don't know but don't work
           Debug "ok" ; if the checkbox is cheched then debug!!!

if not checked do this...other code
           
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: How To Work Whith Checkbox Gadget

Post by Keya »

Code: Select all

Global Window_0, mytest

Procedure OpenWindow_0 (x = 0, y = 0, width = 280, height = 110)
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
  Mytest = CheckBoxGadget(#PB_Any, 80, 40, 100, 25, "Mytest")
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
        Case  Mytest
           If GetGadgetState(Mytest) = 1
             Debug "Checked"
           Else
             Debug "Unchecked"
           EndIf
           
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

OpenWindow_0()
Repeat
  Define event.i = WaitWindowEvent()
  Window_0_Events(event)
Until event = #PB_Event_CloseWindow
End
User avatar
LESTROSO
Enthusiast
Enthusiast
Posts: 124
Joined: Thu Nov 03, 2005 12:30 pm
Location: Italy
Contact:

Re: How To Work Whith Checkbox Gadget

Post by LESTROSO »

Thank You keya!!! Thousands Thanks!!

Thank for your help....now i understand how it works....

Best regards,

Lestroso :D :D :D
Post Reply