|
From: Patrick E. <pa...@pa...> - 2004-04-02 07:33:48
|
On Thursday 01 April 2004 00:42, Joakim Verona wrote:
> The later aproach could maybe be achieved with 2 resources, one for
> the dialog, and one used as a template for dynamic addition to the
> parent dialog.
That's a cool idea. I'm implementing something right now, I think it
will work out well. I don't have time to finish it tonight, but I'll
describe the basic idea.
I've created a new class called jppResourcePanel. You construct it by
passing it a name and it will load the named panel from one of the
same files you did a jppResourceDialog::LoadResource() on.
Once you have the panel, there's a method that's used to add it to an
existing dialog, namely to a sizer within the dialog. It would work
something like this, minus the pythonish for loop:
jppResourceDialog dialog("myDialog", parentWin);
for x in ["one", "two", "three"] {
jppResoucePanel panel("myPanel");
wxLabel *label = (wxLabel *) panel.FindWindowByName("myLabel");
if(!label) cout << "You crazy!";
label.SetText(x);
dialog.AddToSizer("mySizer", panel);
}
I haven't though through the memory management yet, so that may be
something like panel = new jppResourcePanel("myPanel"). In any case,
it's nearly as simple. Does that look good? Are there improvements
to be made?
Okay, time for bed.
Patrick
|