See the documentation for the `pref-dim` word.
If you read/write the `pref-dim` slot for random gadgets, you will mess up the caching of the value and possibly the layout logic of the `ui.gadgets` vocab.
It's OK to set the initial value if you don't want to override the `pref-dim*` method for that purpose.
25.07.2019, 15:59, "John Benediktsson" <mrj...@gmail.com>:
It's probably to set the default / initial size of the gadget.Some gadgets do it by overriding the ``pref-dim*`` word like so:./extra/tetris/tetris.factor:M: tetris-gadget pref-dim* drop { 200 400 } ;And a few do it by setting it like that... I think the ``pref-dim*`` approach was the intended approach, but even the ``MAIN-WINDOW:`` word sets the pref-dim slot on the world for its initial size (and the world is a track gadget...).I kind of think a constructor type word should be able to just do { 200 400 } >>pref-dim and then later that slot can be changed dynamically, etc... dunno.,,On Thu, Jul 25, 2019 at 5:15 AM Georg Simon <georg.si...@auge.de> wrote:https://docs.factorcode.org/content/word-gadget,ui.gadgets.html says
"pref-dim -
a cached value for pref-dim; do not read or write this slot directly."
But in extra/gesture-logger/gesture-logger.factor
and extra/rosetta-code/animate-pendulum/animate-pendulum.factor
I find
{ 450 500 } >>pref-dim
and
{ 500 500 } >>pref-dim
What is right ?
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk
---=====---
Александр
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk