Computer Science Canada

Shoes and edit boxes

Author:  apomb [ Sat Jun 06, 2009 2:16 pm ]
Post subject:  Shoes and edit boxes

Alright, so i've been messing around with shoes, and i'm wondering if there is a way of changing input text when dealing with edit lines.

For example, as the user is typing, the text inside the box is masked as an asterisk

here's what i have so far. Its not much, but its where im going to start from.
Ruby:
Shoes.app do
        stack :margin => 4 do
                @fill = para strong("Guess the password")
                @line = edit_line :width => 100
                @butt = button "Hit this button to enter text"
                @text = para " "
                @butt.click{
                        @new = @line.text
                        if @new == "pass"
                   @fill.replace strong("Congrats")
                           @text.replace " "
                        else
                           @text.replace "Not correct"
                    end
                }
        end
end

Author:  Tony [ Mon Jun 08, 2009 12:13 pm ]
Post subject:  RE:Shoes and edit boxes

with Events
http://help.shoooes.net/Events.html#keypress{|key|...}

Author:  apomb [ Mon Jun 08, 2009 7:37 pm ]
Post subject:  RE:Shoes and edit boxes

thanks tony, ill check that out.

Author:  apomb [ Thu Jun 11, 2009 8:45 am ]
Post subject:  RE:Shoes and edit boxes

Ok, well ive tried that out, but it doesnt work when I'm typing inside the edit box.

Author:  Tony [ Thu Jun 11, 2009 10:52 am ]
Post subject:  RE:Shoes and edit boxes

You could get them to type outside of an edit box, effectively building your own control.

Though it's odd... it seems like there should be an easier way for something like this. I don't actually use Shoes...

Author:  apomb [ Fri Jun 12, 2009 10:04 am ]
Post subject:  RE:Shoes and edit boxes

Indeed it seems like a somewhat common thing. I'll look into it further, thanks for the help though. and yeah, i guess i could just make my own text box essentially by drawing a box, fill it white and just update the letters using the keystroke {|key|...} idea.


: