Re: Tip for using Compound Widgets [message #31946 is a reply to message #31682] |
Thu, 29 August 2002 10:13  |
Rob.Preece
Messages: 8 Registered: December 1999
|
Junior Member |
|
|
In article <MPG.17b8dc785d0409dc98994f@news.frii.com>, David Fanning
<david@dfanning.com> wrote:
>
> I have an "event handler" for the compound widget (same as in
> widgets), but any widget that generates events has a structure
> in its UVALUE that has an "object" field and a "method" field.
> For example, here is a quit button (in another program, not
> FSC_FIELD):
>
> button = Widget_Button(bbase, Value='Quit', $
> UVALUE={object:self, method:'Quit'})
>
> All the event handler does is get the user value and dispatch the
> event to this method of this object:
>
> PRO EVENTHANDLER, event
> Widget_Control, event.id, Get_UValue=cmd
> Call_Method, cmd.object, cmd.method, event
> END
>
Good grief! You are *this* close to creating a 'command macro' language
for your widget objects (something I have been thinking about for some
time, I might add!). All that is needed is a way to store lists of
commands, so that they could be replayed at any time. It would be nice to
edit, store and recall these lists. Finally, think about a *recordable*
widget program: hit a button, and the following user actions are saved as
a list of commands, to be available for later replay...
> I use the EVENTHANDLER to handle *all* object widget events.
> The objects and methods vary, of course. The methods are written
> *exactly* like previous event handler procedures, except they
> don't have to have the info structure, since the info structure
> *is* the object!
>
Hmm. You have a global commmand dispatch object then? I like it even
better. I suppose that positional parameters for the methods are contained
in the event structure passed to CALL_METHOD...
- Rob
(P.S. to David: I blew through Bolder on my family trip to Utah earlier in
the summer. We arrived *way* too late to look you up for a Fat Tire ale,
so I owe you one.)
|
|
|