Prima::ScrollBar(3)

πŸ“¦
version 1.74000 Β· 5 versions
, in opensuse-leap 16.0

πŸ’… Prima::ScrollBar ✨

okay so bestie, this is the Prima::ScrollBar page from the Prima toolkit docs (that's the User Contributed Perl Documentation section of the perl manpages, iykyk) β€” and it's literally just about scroll bars. standard vertical ones, standard horizontal ones. that's the whole vibe. πŸŽ€


🌸 NAME 🌸

Prima::ScrollBar β€” scroll bars. that's it. that's the widget. πŸ’…


✨ SYNOPSIS ✨

okay so here's how you actually touch this thing πŸ‘‡

        use Prima::ScrollBar;

        my $sb = Prima::ScrollBar->new( owner => $group, %rest_of_profile);
        my $sb = $group-> insert( 'ScrollBar', %rest_of_profile);

        my $isAutoTrack = $sb-> autoTrack;
        $sb-> autoTrack( $yesNo);

        my $val = $sb-> value;
        $sb-> value( $value);

        my $min = $sb-> min;
        my $max = $sb-> max;
        $sb-> min( $min);
        $sb-> max( $max);
        $sb-> set_bounds( $min, $max);

        my $step = $sb-> step;
        my $pageStep = $sb-> pageStep;
        $sb-> step( $step);
        $sb-> pageStep( $pageStep);

        my $partial = $sb-> partial;
        my $whole = $sb-> whole;
        $sb-> partial( $partial);
        $sb-> whole( $whole);
        $sb-> set_proportion( $partial, $whole);

        my $size = $sb-> minThumbSize;
        $sb-> minThumbSize( $size);

        my $isVertical = $sb-> vertical;
        $sb-> vertical( $yesNo);

        my ($width,$height) = $sb-> get_default_size;

πŸ¦‹ DESCRIPTION πŸ¦‹

Prima::ScrollBar implements standard vertical and horizontal scrollbars. literally the little draggy bar. the icon. the moment. πŸ‘‘


πŸŽ€ API πŸŽ€

🌈 Properties 🌈

  • autoTrack BOOLEAN β€” tells the widget whether it should send the Change notification during mouse tracking events. ngl, you should really only set this to 0 on very slow computers. default: 1.
  • growMode INTEGER β€” default is gm::GrowHiX, which means the scrollbar tries to keep a constant distance from its right edge to its owner's right edge whenever the owner resizes. perfect for horizontal scrollbars, fr fr. πŸ’–
  • height INTEGER β€” default is $Prima::ScrollBar::stdMetrics[1], which is an operating-system-dependent value that gets determined by calling Prima::Application-> get_default_scrollbar_metrics. and yes, the height matters here because by default you're getting a horizontal ScrollBar. that's the tea. β˜•
  • max INTEGER β€” sets the upper limit for value. default: 100.
  • min INTEGER β€” sets the lower limit for value. default: 0.
  • minThumbSize INTEGER β€” the minimal thumb breadth, in pixels. the thumb's main dimension can't go smaller than this. default: 21.
  • pageStep INTEGER β€” this is the increment/decrement applied to value during the operations that are supposed to scroll by pages β€” like clicking the mouse on the strip outside the thumb, or pressing PgDn or PgUp. default: 10.
  • partial INTEGER β€” tells the scrollbar how many imaginary units the thumb should occupy. see whole down below πŸ‘‡. default: 10.
  • selectable BOOLEAN β€” default is 0. set it to 1 and the widget receives keyboard focus; when it's in focus the thumb bar is blinking. main character energy tbh. ✨
  • step INTEGER β€” the minimal increment/decrement to value during mouse/keyboard interaction. default is 1.
  • value INTEGER β€” the basic scrollbar property, bestie. reflects the imaginary position between min and max, and that maps directly to where the thumb sits. default is 0.
  • vertical BOOLEAN β€” determines the main scrollbar style. set it to 1 for vertical, 0 for horizontal. and the slay part? it can be changed at run-time, so scrollbars can morph from horizontal to vertical and back. shapeshifter vibes πŸ¦‹. default is 0.
  • whole INTEGER β€” tells the scrollbar how many imaginary units correspond to the whole length of the scrollbar. this value has nothing in common with min and max, ok? think of partial + whole together as the proportion between the visible size of something (a document, for example) and the whole size of that same "something". default is 100.

πŸ’œ Methods πŸ’œ

  • get_default_size β€” returns two integers: the default platform-dependent width of a vertical scrollbar, and the height of a horizontal scrollbar. two for one, we love to see it. 🫢

πŸ“ Events πŸ“

  • Change β€” the Change notification gets sent whenever the thumb position of the scrollbar changes β€” subject to certain limitations when autoTrack is 0. and it's sent when appropriate, no matter whether it happened because of user interaction or because of some side effect from a method you the programmer called. equal opportunity notifier. πŸ’…
  • Track β€” if autoTrack is 0, this gets called when the user changes the thumb position with the mouse. πŸ–±οΈ

πŸ”₯ EXAMPLE πŸ”₯

here's a whole little working moment, go off πŸ‘‡

        use Prima;
        use Prima::Application name => 'ScrollBar test';
        use Prima::ScrollBar;

        my $w = Prima::Window->new(
                text => 'ScrollBar test',
                size => [300,200]);

        my $sb = $w-> insert( ScrollBar =>
                width => 280,
                left => 10,
                bottom => 50,
                onChange => sub {
                        $w-> text( $_[0]-> value);
                });

        run Prima;

🌟 SEE ALSO 🌟

Prima, Prima::Widget, examples/scrollbar.pl, examples/scrollbar2.pl β€” go read those too, iykyk πŸ“šβœ¨


πŸ‘‘ AUTHORS πŸ‘‘

Dmitry Karasik <dk@plab.ku.dk>, Anton Berezin <tobez@plab.ku.dk> β€” documentation. tagging them both, absolute icons for writing all this down πŸ«ΆπŸ’–


and that's the whole page bestie!! no cap, you're now a certified scrollbar understander πŸŽ€βœ¨

okay so the tiny fine print at the bottom: this is from perl v5.42.0, dated 2024-08-20, and it's the Prima::ScrollBar(3) manpage. slay, go forth and scroll πŸ’…πŸŒŸ

πŸ“¦ where this page comes from