-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow nil in listbox, setting text to item not in the items list. #67
Comments
@meruby 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:
Ah,... what does it mean to add? |
If user has det default value to say 9 in list box, but list contains only Samir On Mon, Aug 27, 2012 at 7:13 AM, ashbb notifications@github.com 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
end
end If so, I'll be able to update Green Shoes. |
Yes, this should work well. Thanks for accepting my suggestion. Samir On Tue, Aug 28, 2012 at 9:52 AM, ashbb notifications@github.com wrote:
|
There are times when you don't want anything from selection. To do this I have to add "nil" in item lists. It works, but I think it is not a bad idea to have a option which allows user to clear selected item. You can do this with new option :entry, but user might want to just allow nil as a selected item without allowing user to type anything. Do you think it make sense?
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.
Once again, thanks for wonderful green_shoes and making changes to it quickly.
The text was updated successfully, but these errors were encountered: