Can i link any functions with "main loop"?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
idontknow
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Jun 10, 2018 11:54 am

Can i link any functions with "main loop"?

Post by idontknow »

Hi, i need to link any functions with "main loop", but i didn't do that before, so i don't know how to do that. I am using template of ccode by wxSmith. Thank you for every answer.
fantomas
In need of some credit
In need of some credit
Posts: 4
Joined: Fri Jun 15, 2018 10:44 pm

Re: Can i link any functions with "main loop"?

Post by fantomas »

to link any functions with "main loop"
Hard to understand what you mean. May be description of what you are going to achieve (what is your task? what do you attempt to resolve?) could help.

wx as most GUI is event-driven. Look to API of wxApp and its base classes wxAppConsole and wxEvtHandler.
There are
wxAppConsole::FilterEvent() - look at every event in the "Loop"
wxEvtHandler::QueueEvent or wxEvtHandler::AddPendingEvent to post events to the loop
Use wxTimer to shedule delayed/periodic task
Check wxIdleEvent for background low-priority tasks.
and so on
If you need to do cpu-intensive work all the time or during continuous periods you have to move it to parallel thread ("worker") and there you may implement all the loops and whistles you may want, but be aware AFAIK you can not access wx GUI from there and need to set up some way of thread communication.
Post Reply