[Pharo-dev] [bloc] shape size?

Thierry Goubier thierry.goubier at gmail.com
Sun Apr 3 17:53:37 EDT 2016


Le 03/04/2016 23:31, Igor Stasenko a écrit :
>
>
> On 4 April 2016 at 00:18, Thierry Goubier <thierry.goubier at gmail.com
> <mailto:thierry.goubier at gmail.com>> wrote:
>
>
>              The scroll is defined in delta in pixels. So, scrolling
>         single line
>              - you scroll by top or bottom line height (depending on
>         direction).
>
>
>     You wrote a dedicated scrollbar? The standard one is [0, 1.0] with a
>     constant step whatever the direction so it's hard to make the
>     difference in height between the top line or the bottom line.
>
>
> Yes. I, of course did not made it dedicated only for text. But i guess
> text is only single user of it so far.

Ok.

>     But it could be worth subclassing ScrollBar for that purpose.
>
>
> Unfortunately, my cognitive capacity was not that high at that moment,
> in order to understand how ScrollBar is working and what needs to be
> done in order to adapt it to my text model. Or maybe because when i was
> looking at its implementation the only thing i was thinking is not to
> run screaming in terror.

:)

> Pick one explanation, that suits you best :)

I'm using the same explanation when I see some widgets. I wanted to use 
a button for expand/unexpand in a tree, looked at the variants of 
ButtonMorphs (and three state button morphs and...), got a headache and 
just took a normal Morph with a custom handler :(

>         Or maybe i lying here.. i could be 'scroll up/down' until
>         next/previous
>         line are fully visible in layout. (There's of course an edge
>         case, when
>         line height is bigger than viewport height)
>
>
>     That edge case is complex to handle...
>
>              Scrolling page - you scroll by using height of viewport. No
>         need to
>              count lines of text.
>              And so, i scan text forward or backward until new layout fully
>              covers part of text after such scrolling. And after it deleting
>              portion of layout that became invisible due to scrolling.
>              The layout has anchor point in text - a position. And then
>              dimensions (width and height) and offset (a delta horizontal or
>              vertical relative to perfect condition when a position in text
>              corresponds to 0,0 point in layout )
>
>
>     Understood for the scan forward or backward.
>
>              The only place where i needed to measure text size was to
>              positioning a scrollbar knob to represent its size & vertical
>              position approximately close to where you in text and text
>         size. And
>              i really don't like that, since it requires scanning whole
>         text..
>              But well... tradeoffs.. It win anyways, since i succeeded
>         to avoid
>              most operations to be bound to text size. And only few
>         left, that
>              you cannot avoid.
>
>
>     What do you scan in the text? Do you compute a complete pixel height
>     of the text or some approximation?
>
>
> Well, for scrollbars it is just counting lines of text. For layout , it
> is of course, fully precise text layout & kerning yadda yadda.

Understood. Thanks again for all the explanations.

Thierry



More information about the Pharo-dev mailing list