i created a dialog and want to pass the dialog to a functor. because i didn't find a function which converts the dialog to a wnd<> i took a look to get_active_wnd() and found out that it's implemented with find_by_hwnd(). ergo i tried this code:
for_each( theDocument().begin(), theDocument().end(), boost::bind(&AbfrageDlgImpl::InsertCharakterPair, find_by_hwnd(raw_hwnd()), _1) );
but an exception will be thrown in get_window_anythread()
saying that the window doesn't exist...but you promised the window still exists in the constructor ;-). i guess the registration of the window to the global list of all windows is somehow broken???
btw is there any function which gets a wnd<> from actual window classes? and if not, it would be nice to have one =)
The window exists, only that find_by_wnd won't find it yet - because it's not fully constructed (that is, you're inside its constructor)
Instead of find_by_wnd(raw_hwnd()), use '*this'
Note: I will look into your other posts as well - somewhere (hopefully) this week.
"btw is there any function which gets a wnd<> from actual window classes? and
if not, it would be nice to have one =)"
Not sure what you mean. Please give an example. Thanks.
the reason i wrote the code above is that *this didn't work...
for_each( theDocument().begin(), theDocument().end(), boost::bind(&AbfrageDlgImpl::InsertCharakterPair, *this, _1) );
this code didn't compile. the InsertCharakterPair() is declared like this:
static void InsertCharakterPair(wnd<> dlg, const CharakterzugPair& charakterZugPair);
so i had to find a way to get a wnd<> from my dialog and the find_by_wnd() seemed to be the solution. i use v1.5.1
- You can do this in your event hander's on_full_create() function (see link below)
(in this case, you know your dialog class is fully cosntructed, and this is what I recommend)
- in InsertCharakterPair function, make dlg a window_base* pointer:
void InsertCharakterPair(YourDlgClass* dlg,...)
thank you, that's it!
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.