Giter VIP home page Giter VIP logo

Comments (4)

ashbb avatar ashbb commented on August 23, 2024

@meruby
If you overwrite Shoes::ListBox#text method like this, you can get nil when you don't select anything.

class Shoes::ListBox
  alias :_text :text
  def text
    return unless @real.active_text
    _text
  end
end

Shoes.app do
  lb = list_box items: [1, 2, 3, 4]
  button 'print' do
    p lb.text
  end
end

But in the above code, once you select one of items, you will never clear the selected item. So, IMHO, it's better to add nil in item list like this: list_box items: [1, 2, 3, 4, nil]

One more thing I think we should add to listbox is if :entry is set to true, allow user to set text value which might not be in the list items.

Ah,... what does it mean to add?
It means that we should add the user input value to the array of items?

from green_shoes.

meruby avatar meruby commented on August 23, 2024

If user has det default value to say 9 in list box, but list contains only
[1,2,3,4,5], we should allow 9 to stay in listbox text if :entry is set to
true. listbox items list will be still same [1,2,3,4,5].

Samir

On Mon, Aug 27, 2012 at 7:13 AM, ashbb [email protected] wrote:

@meruby https://github.com/meruby
If you overwrite Shoes::ListBox#text method like this, you can get nilwhen you don't select anything.

class Shoes::ListBox
alias :_text :text
def text
return unless @real.active_text
_text
endend
Shoes.app do
lb = list_box items: [1, 2, 3, 4]
button 'print' do
p lb.text
endend

But in the above code, once you select one of items, you will never clear
the selected item. So, IMHO, it's better to add nil in item list like this: list_box
items: [1, 2, 3, 4, nil]

One more thing I think we should add to listbox is if :entry is set to
true, allow user to set text value which might not be in the list items.

Ah,... what does it mean to add?
It means that we should add the user input value to the array of items?


Reply to this email directly or view it on GitHubhttps://github.com//issues/67#issuecomment-8052811.

  • Samir Patel

from green_shoes.

ashbb avatar ashbb commented on August 23, 2024

You mean the following snippet should work well. Right?

Shoes.app do
  lb = list_box items: [1, 2, 3, 4], entry: true, choose: 9
  button 'print' do
    p lb.text
  end
end

If so, I'll be able to update Green Shoes.
But if there is still my misunderstanging, please let me know.

from green_shoes.

meruby avatar meruby commented on August 23, 2024

Yes, this should work well. Thanks for accepting my suggestion.

Samir

On Tue, Aug 28, 2012 at 9:52 AM, ashbb [email protected] wrote:

You mean the following snippet should work well. Right?

Shoes.app do
lb = list_box items: [1, 2, 3, 4], entry: true, choose: 9

button 'print' do
p lb.text
endend

If so, I'll be able to update Green Shoes.
But if there is still my misunderstanging, please let me know.


Reply to this email directly or view it on GitHubhttps://github.com//issues/67#issuecomment-8092081.

  • Samir Patel

from green_shoes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.