Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 211347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:05:13+00:00 2026-05-11T18:05:13+00:00

Shoes is very handy GUI tool. I would like to do a search form

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:05:14+00:00Added an answer on May 11, 2026 at 6:05 pm

    Unfortunately, Shoes doesn’t seem to provide any way to do that. These are the only methods defined on EditBox (it inherits from Native, which has several methods, but again, none to reposition the cursor).

    rb_define_method(cEditBox, "text", CASTHOOK(shoes_edit_box_get_text), 0);
    rb_define_method(cEditBox, "text=", CASTHOOK(shoes_edit_box_set_text), 1);
    rb_define_method(cEditBox, "draw", CASTHOOK(shoes_edit_box_draw), 2);
    rb_define_method(cEditBox, "change", CASTHOOK(shoes_control_change), -1);
    

    http://github.com/why/shoes/blob/cea39a8bf9a5b7057b1824a9fab868d1f8609d69/shoes/ruby.c

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was taking a look at Shoes which seems like a very nice tool
I would like to develop a system, where user will get the data dynamically(what
I have an Android Spinner view in my layout. I would like that spinner
I'm getting a very weird drawing bug in Safari, and i would like to
I am trying to write a simple tool using Shoes. This will indent code
I have a highlighting mode (forget what it's called) that shows me, through highlighting
I've been directed to an very nice article that shows how to create a
I have a search in solr that is returning about 1500 documents. These documents
This is probably a very dummy question, don't throw your shoes at me :)
I would like to preface this with I'm not trying to start a fight.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.