[GUI Design] How to achieve short comm paths between controls?

F

F. GEIGER

+--------------------------------------------------------------+
| |
+--------------------------------------------------------------+
| +--------+ |
| | Page 1 | |
|-+ +---------------------------------------------------|
| | +- Group ------------------------+|
| # | ||
| lhs pane | | || rhs pane
| | | ||
| | | ||
| +----------------------+ | | ||
| |A control, | | | Editor object ||
| |which properties | | | ||
| |have to be edited | | | ||
| |with the editor in the| | | ||
| |rhs pane | | | ||
| +----------------------+ | | ||
| | +--------------------------------+|
+--------------------------------------------------------------+

When I click on the control within the lhs pane, I want to display the
appropriate editor, which displays the control's properties. To do so I need
the group box in the rhs pane as the editor's parent. Therefore the text
control tells the MainFrame (module variable as a singleton) to display the
right editor. So this path is short.

But now, down the path, I get into troubles: The MainFrame does not know
about the group box in the rhs pane of the active page of the notebook
within the MainFrame. See?

So the path is: MainFrame ---displayEditor()-->
NoteBook ---displayEditor()--> Currently selected page. The nesting down
stops here, because the page knows about the group box within the pane,
because it created them.

I'm in doubt that this is a design pattern issue. I guess it's about
organizing all the controls of a GUI.

Should I create a dict with control name/object pairs, held by the
MainFrame?

Or should the rhs group box a globally accessible singleton or Borg?

Any other hint? How do you handle such situations?

I sketched the app both with wxPython and PMW/Tkinter. Is this what PyQt's
slots are for? Can I connect the lhs control with the rhs group box? It'S
hard for me to see how this would solve the problem, because the distance
between the controls remains. Well, I guess the dict mentioned above is not
the worst here, is it?

Any hint welcome.

Regards
Franz GEIGER
 
C

Cliff Wells

On Wed, 2003-08-27 at 12:29, F. GEIGER wrote:

[snip nice diagram]
Should I create a dict with control name/object pairs, held by the
MainFrame?

This doesn't sound too bad.
Or should the rhs group box a globally accessible singleton or Borg?

Trying to get past my prejudice against the word global to see this
solution objectively and just can't.
Any other hint? How do you handle such situations?

Perhaps by generating a custom event and posting it to the main window?
If you're using wxPython, you might take a look at the dispatcher
module. I haven't used it yet, but it might be appropriate to this sort
of task. Regardless, I'd certainly post to the wxPython user list to
see what people there come up with.

Regards,
Cliff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top