Hello All,
i need some suggestion, in particular if there is a kind of class/tool i can use to remember some events order:
i have myframe, i click on a button, the event for button down is emitted. In the following code, OnBtnDown is entered.
With a very quick tap on the mouse, "before" OnBtnDown is completed, OnBtnUp happen.
It should someway "leave a messge and exit", to be executed only when all OnBtnDown is completed.
void MyFrame::OnBtnDown (wxMouseEvent &)
{
line of code 1
line of code 2
line of code 3
--> OnBtnUp happen
line of code 100
}
void MyFrame::OnBtnUp (wxMouseEvent &)
{
...
}
Is there some kind of semaphore class/tool to keep track of the right sequence of events ?
Many thanks,
Angelo
events problem Topic is solved
events problem
spectrum
-
- wxWorld Domination!
- Posts: 1059
- Joined: Sun Dec 30, 2007 6:40 pm
- Location: Canada
Hi Angelo,
Are you multi-threading? I didn't think what you described was an issue unless you were.
If you are, have a look at wxMutex:
http://docs.wxwidgets.org/2.6/wx_wxmutex.html
Hope that helps,
Jim
Are you multi-threading? I didn't think what you described was an issue unless you were.
If you are, have a look at wxMutex:
http://docs.wxwidgets.org/2.6/wx_wxmutex.html
Hope that helps,
Jim
OS: Vista SP1, wxWidgets 2.8.7.
hi all,
doublemax,
yes, it happen, normally you don't see it for small event handlers.
There is no multithreading for this, is just a simple mechanism:
OnBtnDown start
--
--
Here Happen OnBtnUp (OnBtnDown execution point is pushed on some stack)
OnBtnUp start
OnBtnUp exit
---
---
OnBtnDown exit
You can see it only on very quick tap on the button, and a quite heavy function code for OnBtnDown. I have traces of it.
JimFairway,
i think this is not a thread issue, events handlers are all in the main wxApp, and wxmutex'es called from the same thread have no effect.
doublemax,
yes, it happen, normally you don't see it for small event handlers.
There is no multithreading for this, is just a simple mechanism:
OnBtnDown start
--
--
Here Happen OnBtnUp (OnBtnDown execution point is pushed on some stack)
OnBtnUp start
OnBtnUp exit
---
---
OnBtnDown exit
You can see it only on very quick tap on the button, and a quite heavy function code for OnBtnDown. I have traces of it.
JimFairway,
i think this is not a thread issue, events handlers are all in the main wxApp, and wxmutex'es called from the same thread have no effect.
spectrum
-
- wxWorld Domination!
- Posts: 1059
- Joined: Sun Dec 30, 2007 6:40 pm
- Location: Canada
no, definitely, i removed every chance to have Yields/sleep inside the event handler. This misaligment still happen, i have traces that shows that "OnButtonUp" happen before the exiting from "OnButtonDown".
Maybe this can be due to the fact that my Frame handle OnIdle eventy also ? There inside there is a wxYield().
Maybe this can be due to the fact that my Frame handle OnIdle eventy also ? There inside there is a wxYield().
spectrum