specific position in area
[1/4] from: moeller_thorsten::gmx::de at: 18-Feb-2002 13:19
Hi,
if i have an layout with an area containing some text and i want to to
insert some text somewhere in a line, not the beginning or end with a click on a
button, how can this be done.
How can i determine where i am in the text?
Are there any suggestions??
Thorsten
--
------------------------------------------------------------------------
Few can foresee whither their road will lead them, till they come to its
end.
[2/4] from: brett:codeconscious at: 19-Feb-2002 14:18
Hi,
view layout [
a: area 500x300 {
> if i have an layout with an area containing some text and i want to to
> insert some text somewhere in a line, not the beginning or end with a
click on a
> button, how can this be done.
}
button "Insert now" [
p: find/tail a/text "somewhere "
insert p "(like here)"
show a
t/text: reform ["Inserted at:" index? p]
show t
]
t: text 200x25 white
]
I hope this helps.
Brett.
[3/4] from: moeller_thorsten:gmx at: 19-Feb-2002 13:51
Hi Brett,
thanks for your reply.
Your example may work when there is a defined word like "somwhere" in the
text to be able to search for with find. But, what i need is to insert text at
the cursor position in the text.
little example:
this is text
when the cursor stands between "is" and "text" i want to be able to insert
my
at this position so that the result is "this is my text".
Is there any way to achieve this with rebol?
Thorsten
[4/4] from: brett:codeconscious at: 20-Feb-2002 18:19
Certainly, you just needed to mention the word "cursor" ;-)
view layout [
a: area "place your cursor then click button" button "insert" [
insert system/view/caret "<inserted>" show a]
]
A few other insights are available if you are "game enough" to sift through
the ctx-text object.
Regards,
Brett.