#4 problem with access to dialog-childs


Hi John,
i created some dialogs on another dialog as childs. when i
wanted to access a dialog within another member-
function with

wnd<AbfrageDlg> dlg = try_child<AbfrageDlg>

this didn't work (always returned null_wnd). the only way
to access the dialog will be to save it in a member-
variable or find it with find_wnd_range() which is very
cumbersome and not consistent with the access to
"normal" controls.

so i printed out the dlg_ctrl_id's of all childs and the
dialogs all had an id of 0. i figured it out that in

template<class impl, class params> inline wnd<impl>
create_dlg_impl( params p, hwnd_proxy parent, const
create_info & info );

dialogs will be created and this could be the place to
apply a small patch:

p_result->dlg_ctrl_id(id); <-- this line is new!
return p_result;

the call to try_child() now succeeds. but what if the user
adds one dialog more than once? they would have the
same id and that isn't acceptable...

a solution would be to have a new parameter in the
create_dlg()-functions which specifies the id the dialog is
given. to be consistent with written code this parameter
must have a default value. best would be to have the
result of dialog_impl::dialog_id() as the default value.

i know you're in trouble with time so i rewrote dialog.hpp
and window.hpp and attached it here ;-). the changes
are enclosed in
// END_FIX_1
blocks so you can easily find them. i tested it and it
works perfectly :-)

greetz steven


  • Steven Weiss

    Steven Weiss - 2004-12-03
  • John Torjo

    John Torjo - 2004-12-16

    Logged In: YES

    Hi fotzor,

    I'm very new to sf.net, so it took a while until I figured
    out what patches mean :)

    What you've described above could certainly be implemented -
    it's not hard.

    The reason I haven't done it, is that I really prefer
    sub_wnd<> (as I think I've explained before).

    I kind of think that in time, you might end up taking that
    "child dialog X", and make it a grand-child (in other words,
    take out that dialog, and put a dialog Y that contains X
    and some other data.

    But I do see your point, and especially with the Resource
    Splitter soon to come out, this makes perfect sense.

    So it's most likely I'll include this in the next release.
    (I'll answer the rest quite soon)


  • John Torjo

    John Torjo - 2004-12-16

    Logged In: YES


    will be in the next release.


  • John Torjo

    John Torjo - 2004-12-16
    • status: open --> closed

Log in to post a comment.