It is currently Mon Jun 18, 2018 2:39 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: SpinGadget + BindEvent + #PB_EventType_Change => not working
PostPosted: Mon Dec 11, 2017 11:41 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 11, 2004 7:07 am
Posts: 549
If you click on the up and down buttons of the SpinGadgets all is OK. But if you type text, then the first input is ignored and all other inputs are 1 event too late:

Code:
Procedure out()
Debug GetGadgetState(0)
EndProcedure

  If OpenWindow(0, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    SpinGadget     (0, 20, 20, 100, 25, 0, 1000, #PB_Spin_Numeric)
    SetGadgetState (0, 5)  ; legt den Anfangswert fest
    BindEvent(#PB_Event_Gadget, @out(), 0, 0, #PB_EventType_Change)
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: SpinGadget + BindEvent + #PB_EventType_Change => not wor
PostPosted: Wed Dec 13, 2017 6:10 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Dec 17, 2009 12:00 pm
Posts: 155
Location: Llangadog, Wales, UK
Confirmed - as reported GetGadgetState returns wrong (previous) value at the event.

However - GetGadgetText always returns the correct value :?

Tested with PB 5.46 Beta 1 and 5.61, x86, MacOS 10.6.8

_________________
www.deeproot.co.uk


Top
 Profile  
Reply with quote  
 Post subject: Re: SpinGadget + BindEvent + #PB_EventType_Change => not wor
PostPosted: Thu Dec 14, 2017 7:03 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1253
Location: Germany
The event change comes too soon.
An event cycle later the result is correct

Translated with http://www.DeepL.com/Translator

Code:
Enumeration #PB_Event_FirstCustomValue
  #My_Event_Window
  #My_Event_Gadget
  #My_Event_Menu
EndEnumeration

Procedure MyEventGadget()
  PostEvent(#My_Event_Gadget, EventWindow(), EventGadget(), EventType())
EndProcedure

Procedure out()
  Protected gadget = EventGadget()
  Select EventType()
    Case #PB_EventType_Change
      Debug "Change: " + GetGadgetState(gadget)
      SetGadgetText(gadget, Str(GetGadgetState(gadget)))
    Case #PB_EventType_Up
      Debug "Up: " + GetGadgetState(gadget)
    Case #PB_EventType_Down
      Debug "Down: " + GetGadgetState(gadget)
  EndSelect
EndProcedure

  If OpenWindow(0, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    SpinGadget     (0, 20, 20, 100, 25, 0, 1000, #PB_Spin_Numeric)
    SetGadgetState (0, 5)  ; legt den Anfangswert fest
   
    BindEvent(#PB_Event_Gadget, @MyEventGadget())
    BindEvent(#My_Event_Gadget, @out(), 0, 0);, #PB_EventType_Change)
   
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye