I want to call gui functions from other threads than the main one. What's the recommended way of doing that in wxD?
From reading wxWidgets docs, it seems that either a custom event, or wxCommandEvent, in combination with wxEvtHandler.AddPendingEvent and ProcessEvent is one way to do this. Does the wxd solution differ much from what the wxWidgets docs say?
Basically I want to duplicate the functionality of DWT's syncExec and asyncExec functions. I tried this:
asyncExec does the same thing, but doesn't block. I haven't thought this through yet, but I suppose mixing phobos threads with wxThreads isn't such a great idea?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to create a custom event now, but I get 'no match for implicit super() call in constructor'. wxD's Event class only has one constructor, which looks like this: 'this(IntPtr wxobj)'. What argument should I give it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Normally the pointer to the associated C++ object gets passed to it. I guess when deriving from it you would pass the pointer to the base c++ object. I don't know how to get one for the wxEvent.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a look at Event's source code, and it doesn't seem that custom events are supported yet. I guess it's a bit too early to try to use wxD for multithreaded apps yet. I'll have to try out yet another GUI library. :(
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want to call gui functions from other threads than the main one. What's the recommended way of doing that in wxD?
From reading wxWidgets docs, it seems that either a custom event, or wxCommandEvent, in combination with wxEvtHandler.AddPendingEvent and ProcessEvent is one way to do this. Does the wxd solution differ much from what the wxWidgets docs say?
Basically I want to duplicate the functionality of DWT's syncExec and asyncExec functions. I tried this:
void syncExec(Object o, void delegate(Object) dg)
{
bool isMain = mainThread.isSelf();
if (isMain) {
dg(o);
}
else synchronized (execMutex) {
MutexGuiEnter();
dg(o);
MutexGuiLeave();
}
}
asyncExec does the same thing, but doesn't block. I haven't thought this through yet, but I suppose mixing phobos threads with wxThreads isn't such a great idea?
I'm trying to create a custom event now, but I get 'no match for implicit super() call in constructor'. wxD's Event class only has one constructor, which looks like this: 'this(IntPtr wxobj)'. What argument should I give it?
Normally the pointer to the associated C++ object gets passed to it. I guess when deriving from it you would pass the pointer to the base c++ object. I don't know how to get one for the wxEvent.
I had a look at Event's source code, and it doesn't seem that custom events are supported yet. I guess it's a bit too early to try to use wxD for multithreaded apps yet. I'll have to try out yet another GUI library. :(