Shoes is very handy GUI tool. I would like to do a search form so that a user is helped to navigate through larger texts for editing. For this I need to move the cursor within an editbox element.
Here you'll see my question in code:
Shoes.app do
stack do
p=para "After pressing 'search' a question will arise"
box=edit_box
box.text="One\nof\nthe\nmost\nstriking\ndifferences\nbetween\na\ncat\nand\na\nlie\nis\nthat\na\ncat\nhas\nonly\nnine lives."
flow :margin_top=>0.1 do
search=edit_line
button("search") do
pos=box.text.index search.text
y = box.text[0..pos].split.size-1 if pos
if not y.nil?
#For example if you searched "only" then
#cursor should jump/scroll to line 17.
#
#Anything there for cursor positioning,
#like: box.cursor=[0,y]
#
p.text="How can I move editbox's cursor in line #{y+1}?"
else
alert "'#{search.text}' not found"
end
end
end
end
end
Is there is any way to change cursor's position of an editbox? If not, do you know an alternative way of implementation?