Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Propose new layout for ttk::combobox and ttk::spinbox

87 views
Skip to first unread message

tombert

unread,
Dec 4, 2011, 5:49:30 PM12/4/11
to
The reason for my proposal are 1) my other post here on google and 2) because I found another inconsistency that the text in the ttk::spinbox is located one pixel higher than in the entry (Windows7).

tspinbox {
Entry.field -sticky nswe -children {
Spinbox.background -sticky nswe -children {
Spinbox.padding -side left -children {
Spinbox.textarea -side left
}
null -side right -children {
Spinbox.uparrow -side top -sticky sne
Spinbox.downarrow -side bottom -sticky sne
}
}
}
}

tcombobox {
Entry.field -sticky nswe -children {
Entry.background -sticky nswe -children {
Combobox.rightdownarrow -side right -sticky ns
Combobox.padding -expand 1 -sticky nswe -children {
Combobox.textarea -sticky nswe %gttk
}
}
}
}

So this allows us to put similar paddings:
ttk::style configure TSpinbox -padding {1 1 1 1}
ttk::style configure TCombobox -padding {1 1 1 1}

And now each entry has similar height, and the combobox goes grey in disabled state.

thx

tombert

unread,
Dec 4, 2011, 6:48:19 PM12/4/11
to
I had a little fight with the spinbox text alignment, so here's an update:

tspinbox {
Entry.field -sticky nswe -children {
Entry.background -sticky nswe -children {
null -side right -children {
Spinbox.downarrow -sticky se
Spinbox.uparrow -sticky ne
}
Spinbox.padding -sticky nswe -children {
Spinbox.textarea -sticky nswe
}
}
}
}

Pat Thoyts

unread,
Dec 6, 2011, 7:58:33 PM12/6/11
to
I suggest you make this a patch instead of trying to make everyone else
integrate your suggestion.
Then knock up a demo that shows each widget in the various states in Tk
so they can be verified and take a screenshot and so the same using C#
or something native to ensure things are matched up. Typically you get
one style working and it breaks on another. eg: Readonly works but
disabled goes weird.
To help - I posted my C# tester to
http://www.patthoyts.tk/programming/ThemeTest.zip

It seems a bit odd to use Entry fields in the Combobox layout. The vista
element collection includes definitions for a combobox field which is
why it is declared that way. It could be it looked right on Vista and is
a bit different on Win7. Or maybe it was always broken. In this case
looking closer - the disabled issue is related to it not being quite
right for readonly. The background should actually be CP_READONLY. When
that element is in state CBRO_DISABLED it will look the way you
want. Also this can produce the correct all-blue look for a readonly
combobox. However it is incorrect for an editable combobox. I posted a
fix for this sometime ago defining an extended style scheme to cover
this but it got rejected in favour of a new widget instead. To create
such an vsapi element you want
ttk::style element create Combobox.field vsapi COMBOBOX 5 \
{disabled 4 pressed 3 active 2 {} 1}
and replace the Combobox.border with this I think.

--
Pat Thoyts http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
0 new messages