Richard Jones' Log: GUI naming issue

Wed, 20 Jun 2007

There's a certain situation in GUIs where an element (e.g. a popup menu) wants to know when the user has clicked on something else other than the menu -- causing the menu to close.

Currently the mechanism in my framework has the menu element calling gui.registerParanoid(self) (gui being the top-level event handler) and if the condition is met then the gui invokes element.itsNotInYourHead().

Hrm :)

Update: Toby's pointed me in the direction of thinking about focus as a solution to the problem. That is, the menu is focused and when it loses focus it closes. That works for most other items too. There's a problem to solve (the menu has to stay alive when its children are focused) but it's not impossible.