ScrollingLabel is a dynamic label which scrolls
from all sides when the parent widget is not large enough.
This widget can be used when you need to build very
compact interfaces and display long strings of
information.
Example of use :
You just need to create a standard widget just like a GtkLabel
<?php
# ....
$text = 'The quick brown fox jumps over the lazy dog.';
$vbox = new GtkVbox();
$vbox->pack_start(new ScrollingLabel( $text ), false, false); #(1)
$vbox->show_all();
# ....
Gtk::main();
?>
Code source
See the attached sources.
Highlights
- widget tree:
GtkFixed /
GtkEventBox / GtkLabel,
GtkEventBox is used to catch button click,
GtkFixed is a special composite widget that
allows widget placement and moves,
- so we move the event box and inside label just to follow
the event box (its parent widget),
- you can adjust class members as needed ; change source or
override class
- click on the event box resets the position
- an application can handle a few such scrolling widget when
not under heavy load ; take care not to use too many instances
of this widget
Enhancement
- we should track the
configure event from
GtkEventBox and set timeout as needed. With
the code as it stands currently, a timeout function is
running even when not needed
Recent comments
6 weeks 1 day ago
12 weeks 13 hours ago
13 weeks 5 days ago
20 weeks 1 day ago
21 weeks 3 days ago
21 weeks 4 days ago
22 weeks 5 days ago
23 weeks 4 days ago
34 weeks 2 days ago
34 weeks 3 days ago