Page 1 of 1

(SOLVED)Problem with Checkbox..Can you help me please???

Posted: Mon Jun 03, 2019 5:57 pm
by LESTROSO
I try to work with this code...but nothing works....i need to use it in a loop but i want to use only when the check box change the state....Can you help me please?? Lestroso :oops:

Code: Select all


Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()

   Case CheckBox_0
                If EventType() = #PB_EventType_Change
                  Select GetGadgetState(CheckBox_0)                  
                    Case 1              
  MessageRequester("CheckBox 0 is ","turned  On...")

      EndSelect
        EndIf
  

Re: Problem with Checkbox..Can you help me please???

Posted: Mon Jun 03, 2019 6:40 pm
by Mijikai
What exactly do you want to do (i dont get it) :?:

Re: Problem with Checkbox..Can you help me please???

Posted: Mon Jun 03, 2019 6:53 pm
by infratec
Why should I wrote code when you want to know something?

Please provide a working example next time.

Maybe you mean something like this:

Code: Select all

If OpenWindow(0, 0, 0, 270, 160, "CheckBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CheckBoxGadget(0, 10,  10, 250, 20, "CheckBox standard")
  CheckBoxGadget(1, 10,  40, 250, 20, "CheckBox checked"): SetGadgetState(1, #PB_Checkbox_Checked)
  CheckBoxGadget(2, 10,  70, 250, 20, "CheckBox three state", #PB_CheckBox_ThreeState): SetGadgetState(2, #PB_Checkbox_Inbetween)
  CheckBoxGadget(3, 10, 100, 250, 20, "CheckBox right", #PB_CheckBox_Right)
  CheckBoxGadget(4, 10, 130, 250, 20, "CheckBox center", #PB_CheckBox_Center)
  Repeat
    Event = WaitWindowEvent()
    
    Select Event
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0 To 4
            Debug "----"
            For i = 0 To 4
              Debug GetGadgetState(i)
            Next i
            
        EndSelect
    EndSelect
    
  Until Event = #PB_Event_CloseWindow
EndIf
A CheckboxGadget() don't fire a #PB_EventType_Change. You have to read the help.

Re: (SOLVED)Problem with Checkbox..Can you help me please???

Posted: Tue Jun 04, 2019 2:53 pm
by LESTROSO
DEAR INFRATEC!!!I thank you, thousands thanks!! You helped me so much!!! Thanks again....Bye Lestroso :D :D :D