tombert wrote:
>
> currently I'am deep into ttk and trying to build my custom widgets.
> The following example is a simplification but it nicely explains my
> problem. I want to create an entry containing custom images showing
> the current state (e.g. warning and error). For this I'am using the
> user definable states "user1" and "user2".
>
> The problem is that the image element always has the width of the base
> image (from file ttkImage.c imageSpec->baseImage) [ ... ]
[ ... example snipped ... ]
> When the states user1 and user2 are activated/deactivated the user2
> state leaves an unwanted whitespace. In my opinion the width should go
> to 0 because of the empty image.
>
> Is this a bug? Can I easily force an image width recalculation?
This is mostly intended behaviour. The basic idea was that
the layout, and hence the overall widget size, should not
depend on the widget state. Otherwise the application would
need to do a (potentially very expensive) geometry propagation
dance every time the focus changed or the mouse moved.
This might be worth revisiting though. Recomputing widget internal
layout isn't expensive -- it does this on every redraw anyway --
the only expensive part is when the required size changes.
It should be possible to use state=0 to compute the default
required baseline size, but let the internal layout vary
within the allocated parcel depending on state.
It would require an incompatible ABI change, though, since
the widget state isn't passed to Ttk_ElementSizeProcs at
present. Maybe for 8.7.
Could you open a bug report at SourceForge so this doesn't
get forgotten?
--Joe English