[Seen]Checkbox+Option gadgets dont mention any EventTypes
Moderator: Documentation Editors
[Seen]Checkbox+Option gadgets dont mention any EventTypes
Checkbox and Option gadgets dont mention which if any EventTypes are supported
(the word 'Event' doesnt even exist apart from WaitWindowEvent in the example)
(the word 'Event' doesnt even exist apart from WaitWindowEvent in the example)
Re: Checkbox+Option gadgets dont mention any EventTypes
They don't support any PureBasic events, so the listing in the manual appears correct.Keya wrote:Checkbox and Option gadgets dont mention which if any EventTypes are supported
(the word 'Event' doesnt even exist apart from WaitWindowEvent in the example)
I think this also means any OS associated events are handled entirely by the OS.
If a coder wanted to respond to OS events she might use a callback or BindGadgetEvents().
Last edited by Demivec on Mon Sep 14, 2015 3:09 pm, edited 1 time in total.
Re: Checkbox+Option gadgets dont mention any EventTypes
Well, the listing in the manual would be "correct" if it actually said no events were supported, rather than not saying anything about it. 
And to some extent an event is supported - if you specify an event for the Option or Checkbox gadget it does trigger an event, but with id 0. Im currently using that to detect state change.
But that isn't mentioned in the helpfile either.

And to some extent an event is supported - if you specify an event for the Option or Checkbox gadget it does trigger an event, but with id 0. Im currently using that to detect state change.
But that isn't mentioned in the helpfile either.
-
- Addict
- Posts: 4786
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Checkbox+Option gadgets dont mention any EventTypes
I think you shouldn't use that event in a normal program. That is probably the reason why it is not mentioned.Keya wrote:if you specify an event for the Option or Checkbox gadget it does trigger an event, but with id 0.
But that isn't mentioned in the helpfile either.

For CheckBoxGadgets and OptionGadgets, GetGadgetState() is supposed to provide the desired information.
Re: Checkbox+Option gadgets dont mention any EventTypes
Probably a good idea to mention it then!?!?!!!Little John wrote:I think you shouldn't use that event in a normal program. That is probably the reason why it is not mentioned.
And yes i know i can use GetGadgetState() - that's how i'm reading the state it's changed to ...
But I need to react when the state changes, so I need an Event of some sort, which ive set in the Visual Designer in its Event field
and that Event does trigger when i click the Option or Checkbox, but yes the Event = 0! (which isnt for example #PB_Event_LeftClick), so even though it works im not sure if im going about it the right way because of no helpfile information about it
-
- Addict
- Posts: 4786
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Checkbox+Option gadgets dont mention any EventTypes
That's what I'm doing, too. And I never needed anything else in this context.Keya wrote:And yes i know i can use GetGadgetState() - that's how i'm reading the state it's changed to ...
CheckBoxGadgets and OptionGadgets do not work like ButtonGadgets.
Re: Checkbox+Option gadgets dont mention any EventTypes
Use BindGadgetEvent(). In this sample code, the third checkbox has its state checked if any event is detected for it. It doesn't matter what it actually is, but it most like is a click event. In any case, that is when the state is checked.Keya wrote:But I need to react when the state changes, so I need an Event of some sort, which ive set in the Visual Designer in its Event field
and that Event does trigger when i click the Option or Checkbox, but yes the Event = 0! (which isnt for example #PB_Event_LeftClick), so even though it works im not sure if im going about it the right way because of no helpfile information about it
Code: Select all
Procedure control_3()
If GetGadgetState(2) = #PB_Checkbox_Checked
DisableGadget(3, #False)
DisableGadget(4, #False)
Else
DisableGadget(3, #True)
DisableGadget(4, #True)
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 270, 160, "CheckBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CheckBoxGadget(0, 10, 10, 250, 20, "Check everything")
CheckBoxGadget(1, 10, 40, 250, 20, "Repeat everything"): SetGadgetState(1, #PB_Checkbox_Checked)
CheckBoxGadget(2, 10, 70, 250, 20, "Use sub-options:"): SetGadgetState(2, #PB_Checkbox_Unchecked)
CheckBoxGadget(3, 40, 90, 210, 20, "Sub-option 1"): DisableGadget(3, #True)
CheckBoxGadget(4, 40, 110, 210, 20, "Sub-option 2"): DisableGadget(4, #True)
BindGadgetEvent(2, @control_3())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Checkbox+Option gadgets dont mention any EventTypes
Open your mind a bitLittle John wrote:That's what I'm doing, too. And I never needed anything else in this context.
CheckBoxGadgets and OptionGadgets do not work like ButtonGadgets.

For a simple example context, imagine a dialog you use for settings/options. You have a label "Mode", and two Option gadgets "Simple" and "Advanced". Under "Advanced" are several more gadgets that are only applicable when "Advanced" is enabled. So when you click the "Advanced" option you want to react so you can Enable those extra gadget items, and likewise Disable them when you click "Simple".
Demi, thankyou kindly for your demo, but is there actually any difference in using Bind rather than just associating the Event like normal via the Visual Designer? (They both just generate the 0 event?)
-
- Addict
- Posts: 4786
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Checkbox+Option gadgets dont mention any EventTypes
I'm aware that you want that.Keya wrote:There are many reasons why you might want/need to react in realtime to an Option or Checkbox changing state.
However, as far as I understood Fred, CheckBoxGadgets and OptionGadgets currently just don't support that officially.
So there seems to be no "bug" in the documentation, but it seems that you want to make a feature request.
Re: Checkbox+Option gadgets dont mention any EventTypes
Im sorry, i will post missing documentation reports to Feature Requests from now on.
-
- Addict
- Posts: 4786
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Checkbox+Option gadgets dont mention any EventTypes
There is no need to document "features" that are not officially supported.Keya wrote:Im sorry, i will post missing documentation reports to Feature Requests from now on.
And there is no need to be chilly, just because I wrote my opinion here.
Re: Checkbox+Option gadgets dont mention any EventTypes
I personally think a simple "This gadget doesn't support any Events" IS needed, otherwise this thread wouldn't exist, nor would anybody be confused about whether or not events are supported - Demivec wasn't 100% sure either.There is no need to document "features" that are not officially supported.
You say the gadget doesnt support events, yet I am able to use the Visual Designer to assign an Event to it which does trigger when I click on it to change the state, so it is supported to some extent, but surely just a bit of clarification is needed here.
I dont understand how no information is better or "correct" than some information. I didn't think it was too much to ask

? i was just apologizing because you seemed annoyed at me posting hereAnd there is no need to be chilly, just because I wrote my opinion here.

Last edited by Keya on Sun Sep 13, 2015 11:36 pm, edited 1 time in total.
-
- Addict
- Posts: 4786
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Checkbox+Option gadgets dont mention any EventTypes
I am sorry for any misunderstanding, too.
I was/am not annoyed.
I just wanted to say: If you want PB to support realtime events for OptionGadgets and CheckboxGadgets, then you should make a feature request.
Otherwise you won't get it.
I was/am not annoyed.
I just wanted to say: If you want PB to support realtime events for OptionGadgets and CheckboxGadgets, then you should make a feature request.
Otherwise you won't get it.

Re: Checkbox+Option gadgets dont mention any EventTypes
it's important information though so I just didn't see it as a "Feature Request" like my wish for native BSTR support but more of a "Bug" because it's needed, not desired. my bad
Re: Checkbox+Option gadgets dont mention any EventTypes
You're welcome.Keya wrote:Demi, thankyou kindly for your demo, but is there actually any difference in using Bind rather than just associating the Event like normal via the Visual Designer? (They both just generate the 0 event?)
I'm not sure about the difference. I wouldn't use the mysterious 0 event. When BindGadgetEvent() is used it isn't being used to distinguish the event but instead it causes a review of the check box's status when any event occurs that involves the check box. My guess is these OS events and I have only been able to test this on windows.
I do see at least one example of using dependent gadgets in the Preferences of the PB IDE under 'Session History', where a check box determines if other options are available. I know that the PB IDE is written in PureBasic also. Perhaps freak will share the method he uses if it doesn't involve any API and if that method is reliable on each OS.
I'm 100% sure that PureBasic defines no events for the check box. The manual lists no events for it under its own section and it also does not list it under the documentation for EventType().
I agree that it would be good to list it as having no events. This would make the manual more consistent. Some of the gadgets without events says "they have no events". A FrameGadget() and a TextGadget() are two examples.
I agree with Little John that it would be a feature request as opposed to a bug report.
In any case lets get some more consistency in the manual.

I wish you well.