I would assume that he meant the button for
demo purposes only. (?)
I would modify the field (perhaps making a style,
if you want multiple fields reacting this way),
adding a facet named like: face/focus-action,
then modify the focus function to look for that
and do it if there is some code there.
(Actually, code should be written the other way
around, but that is the order of execution, anyway.)

; modfiy the global focus function
        print mold head  insert find/tail second :focus [[hilight-all face]] bind [
        ;print [face/offset face/text face/size]
        if all [in face 'focus-action block? face/focus-action][
                ;print "do focus-action"
                do face/focus-action
        ]
        ] fourth second :focus ; (pick out a local word 'face in the func body)

; test with special field
        view layout [
                field "regular field"
                f: field "special" with [focus-action: [print "hello"]]
        ]

Bindology took some experimenting... :)
Tested OK on Rebol/View 1.2.10, 1.2.8, 1.2.5 and 1.2.1.

Anton.

> Hi
>
> > I am trying to find where I can drop some code into a view field the
> > instant that the field becomes active.
> > For example:
> >
> > view layout [ f1: field
> > button [ focus f1 ]
> > ]
> >
> > So that when I press the button and the field f1 becomes the
> > focus I want some code to run. Can't seem to find this particular
> > situation using detect or insert-event-func.
>
> In this exact case you can do a simple:
>
> my-code: [print 1]
>
> view layout [ f1: field
>     button [
>         do my-code
>         focus f1
>      ]
> ]
>
> Focus function does not create an event, so you can't intercept a
> not existing
> event.
>
> ---
> Ciao
> Romano

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to