Found an issue in SpiderBasic ? Please report it here !
JCV
 
Posts: 11
Joined: Wed Apr 17, 2019 6:08 am

[Done] 2.21 - optiongadget event

by JCV Sun May 05, 2019 5:29 am

From the code below, please try to click each optiongadget.
Sometimes, 2 gadgets event are triggered.

Code: Select all
Procedure Clicked()
  Debug "Clicked"
  GadgetNumber = EventGadget()
  State = GetGadgetState(GadgetNumber)
  Debug  FormatDate("%hh:%ii:%ss ", Date()) + "Gadget: " + Str(GadgetNumber) +  " = " + Str(State)
EndProcedure

If OpenWindow(0, 0, 0, 140, 110, "OptionGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  OptionGadget(0, 30, 20, 100, 20, "Option 1")
  OptionGadget(1, 30, 45, 100, 20, "Option 2")
  OptionGadget(2, 30, 70, 100, 20, "Option 3")
  BindGadgetEvent(0, @Clicked())
  BindGadgetEvent(1, @Clicked())
  BindGadgetEvent(2, @Clicked())
EndIf

; Repeat : Until WaitWindowEvent(10) = #PB_Event_CloseWindow ; Works in PB correctly
munfraid
 
Posts: 30
Joined: Sat Mar 24, 2018 1:33 pm

Re: 2.21 - optiongadget event

by munfraid Mon May 06, 2019 9:24 am

I think this happens, because there are two events: One OptionGadget switch from "on" to "off" and another OptionGadget vice versa. Only the very first click triggers just one event, because only one Gadget is affected.

But there should be the same behaviour in PB and SB.
JCV
 
Posts: 11
Joined: Wed Apr 17, 2019 6:08 am

Re: 2.21 - optiongadget event

by JCV Tue May 07, 2019 7:29 am

Hi munfraid,
Yes I tried that since in manual it says it is grouped as one but events of all gadget are not triggered.
For now I used checkbox instead of optiongadget until it is fixed.
the.weavster
 
Posts: 168
Joined: Sat Mar 01, 2014 3:02 pm

Re: 2.21 - optiongadget event

by the.weavster Tue May 07, 2019 8:48 am

You could use GetGadgetState() as a conditional so your handler is only responding to the item that was selected not the one which was deselected.
Fred
Site Admin
 
Posts: 1162
Joined: Mon Feb 24, 2014 10:51 am

Re: 2.21 - optiongadget event

by Fred Fri Aug 30, 2019 9:33 am

Fixed.
Return to Bugs Reports

Who is online

Users browsing this forum: No registered users and 3 guests