hi everyone,
i open a dialog via showModal and within that dialog, i want to activate a possibility to click on a wxDC in the main application. the problem is, I still want to disable clicking on anything else but the wxDC outside of the dialog. is there some way to make an exception to showModal or some way other than temporarily disabling every control in the main app by hand?
thanx!
showModal, but click on wxDC in main window Topic is solved
Just for clarification: You can't click on a wxDC. A device context is more like an abstract concept to draw on something. You always click on a wxWindow or derived class.
wxWindowDisabler could do the disabling work for you:
http://docs.wxwidgets.org/stable/wx_wxw ... owdisabler
Another option could be to keep working with a modal dialog, but capture all mouse events and detect clicks on the other window yourself.
http://docs.wxwidgets.org/stable/wx_wxw ... pturemouse
And you'd need this:
http://docs.wxwidgets.org/stable/wx_wxw ... entoclient
(Just an idea, don't know if this works)
wxWindowDisabler could do the disabling work for you:
http://docs.wxwidgets.org/stable/wx_wxw ... owdisabler
Another option could be to keep working with a modal dialog, but capture all mouse events and detect clicks on the other window yourself.
http://docs.wxwidgets.org/stable/wx_wxw ... pturemouse
And you'd need this:
http://docs.wxwidgets.org/stable/wx_wxw ... entoclient
(Just an idea, don't know if this works)
Use the source, Luke!
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
for those with this problem, wxWindowDisabler did not work, because i wanted to have an underlying nested wxWindow handle mouse clicks. wxWindowDisabler disables all of the parents of the nested window, so no mouse click came through.
the solution was to recursively disable all parents and all of their children, excluding only the parents of the nested window.
beginning in the nested wxWindow, which also has children i wanted to disable:
i also use the same function for reenabling everything later.
the solution was to recursively disable all parents and all of their children, excluding only the parents of the nested window.
beginning in the nested wxWindow, which also has children i wanted to disable:
Code: Select all
void recursivelyDisEnableAllParents( bool enable )
{
wxWindow *curWin = this;
wxWindow *child = childOfNestedWindowRemainingActive;
while(curWin != NULL){
for(unsigned int i = 0; i < curWin->GetChildren().GetCount(); i++){
wxWindow *win = curWin->GetChildren().Item(i)->GetData();
if(win != child)
win->Enable(enable);
}
child = curWin;
curWin = curWin->GetParent();
}
}