At 2:45 PM +0300 9/26/01, Douglas Wagner wrote:
>Given a window with two sets of controls, one of which is invisible at any
>one time, and a "toggle" button, which switches the visibility of the
>groups. The effect of this is a "two layer" window. Ignore, for the moment,
>any procedural approach to this. Rather, I'm wondering is there an objected
>oriented approach?
>
>At startup one set of controls would default to "invisible" the other
>"visible". The toggle button would originate the switch message. And this
>would be received and implemented by any "listener" which happened to be
>registered for that event. Registration would be achieved by creating a sub
>class of a control and attaching an interface which contains a "switch"
>method. The import point here is that the window behavior can be extended
>merely by registering more listeners. There is no need to go into the code
>and modify a list of controls (or by implementing a loop which is
>procedural).
>
>The ideal solution would have "registered listeners" (like those in Java).
>Can this be done, or simulated in Revolution?
Forgive my lack of object-oriented geekness, but you can easily do the following --
you tell me how well it matches your expectations:
Create two cards.
Put the first set of controls on the first card.
Put the second set of controls on the second card.
Now you have much the situation you seem to be describing:
-- The controls are automatically visible/invisible, as appropriate. No code other
than "go card firstCard" and "go card secondCard"
-- You can add controls to either card, and they will automatically have the same
behavior as the other controls on that card.
regards,
Geoff