-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
select widget grows the enclosing window too wide #1247
Comments
JAVAfx handles this by leaving the place holder as is and putting a check mark on the last selected item. The drop down is allowed to grow horizontally. |
Thanks and sorry for the slow reply on this - I will aim to get that added shortly so it's in our next release |
One assumes that when the item is selected it is expected that the select button will not expand to fit it? |
The drop down box already expands to fit the items. But the place holder box affects the container in which it is displayed. In my version, I skip the sizing based on the max item. plus I just leave the "Place Holder" text alone. this is what javafx does, with the exception of putting a check mark on the last item selected. In my usage, I operate on the selected item and having a check / highlight is unnecessary |
Biggest change is that the drop-down can be larger than button. Also button will not grow to fit selected item. Fixes fyne-io#1247
The PR should contain a solution that works for you, feel free to test :) |
It works as I would have desired. Changing the padding was "fyne" with me :-)). I have 2 Selects in a Hbox surrounded and separated by Buttons (i.e. BBBBSBSBB). The padding and BOLD make the 2 Selects stand out. |
Biggest change is that the drop-down can be larger than button. Also button will not grow to fit selected item. Fixes #1247
Describe the bug:
I have several select widgets that get options added dduring runtime. Adding long options to these select widgets causes the width of the enclosing window to grow without bounds. In select.go, only using the PlaceHolder size and not including the maximum option size makes the button stay at it's original size and the display box expands into the window below to show all the options .
To Reproduce:
Steps to reproduce the behaviour:
create a select widget and add longer and longer options to the Options [] string.
open the select box after each add.
the enclosing window grow, and grows,....
Screenshots:
this image if after a homemade patch (see below) to select.go to keep the MinSize at the size of the PlaceHolder:
Example code:
func (s *selectRenderer) MinSize() fyne.Size {
s.combo.propertyLock.RLock()
defer s.combo.propertyLock.RUnlock()
min := fyne.MeasureText(s.combo.PlaceHolder, s.label.TextSize, s.label.TextStyle)
// for _, option := range s.combo.Options {
// optionMin := fyne.MeasureText(option, s.label.TextSize, s.label.TextStyle)
// min = min.Union(optionMin)
// }
min = min.Add(fyne.NewSize(theme.Padding()*4, theme.Padding()*2))
return min.Add(fyne.NewSize(theme.IconInlineSize()+theme.Padding(), 0))
Device (please complete the following information):
The text was updated successfully, but these errors were encountered: