Applying Focus
[1/7] from: philb:upnaway at: 18-Feb-2002 10:42
Hi,
When opning a new window is it possible to get focus to be applied to the first field
so text can be entered without using the mouse to select the field?
Cheers Phil
[2/7] from: brett:codeconscious at: 18-Feb-2002 15:45
Hi Phil,
> When opning a new window is it possible to get focus to be applied to the
first field so text can be entered without using the mouse to select the
field?
view layout [f: field field do [focus f]]
Cheers
Brett.
[3/7] from: gscottjones:mchsi at: 18-Feb-2002 6:40
From: philb
>When opning a new window is it possible to
>get focus to be applied to the first field so text
> can be entered without using the mouse to
> select the field?
Hi, Phil,
Not knowing what widgets you have before the first field, this example shows
how to set the focus to a specific field.
view layout [
field
f2: field
field
do [focus f2]
]
Hope that helps.
--Scott Jones
[4/7] from: rebol::optushome::com::au at: 19-Feb-2002 6:59
And if you want it highlighted too, here's how. (from
http://www.rebolforces.com/view-faq.html#sect2.4.)
highlight-text: func [face][
focus face
system/view/highlight-start: head face/text
system/view/highlight-end: tail face/text
system/view/caret: head face/text
]
view layout [name: field "<enter your name>" do [highlight-text name]]
Cheers,
Allen K
[5/7] from: rotenca:telvia:it at: 19-Feb-2002 0:13
Hi, Allen
I think that the 'field flag should be enouph to highlit, look at the source
of focus:
...
if flag-face? face field [hilight-all face]
and the standard function:
ctx-text/hilight-all: func [face][
view*/highlight-start: head face/text
view*/highlight-end: tail face/text
]
---
Ciao
Romano
[6/7] from: philb:upnaway at: 19-Feb-2002 9:19
Hi Romano,
Yes, when you use do [focus <fieldname>"] in your your layout the field's text is highlighted
(I just tried it).
Thanks for all the help guys .... these little things just make programs that little
bit more productive/user friendly.
Cheers Phil
=== Original Message ===
Hi, Allen
I think that the 'field flag should be enouph to highlit, look at the source
of focus:
....
if flag-face? face field [hilight-all face]
and the standard function:
ctx-text/hilight-all: func [face][
view*/highlight-start: head face/text
view*/highlight-end: tail face/text
]
---
Ciao
Romano
[7/7] from: g:santilli:tiscalinet:it at: 19-Feb-2002 11:36
At 00.13 19/02/02, you wrote:
>I think that the 'field flag should be enouph to highlit, look at the source
>of focus:
I think that that FAQ comes from earlier versions of FOCUS that did not
highlight text (I don't remember if it was in xpers or in 1.1...).
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r