LibUI
view release on metacpan or search on metacpan
### `uiNewVerticalSeparator( )`
```perl
my $hsplit = uiNewVerticalSeparator( );
```
Creates a new vertical separator.
## Combobox Functions
A combobox is a control to select one item from a predefined list of items via a drop down menu.
You may import these functions with the `:combobox` tag.
### `uiComboboxAppend( ... )`
```
uiComboboxAppend( $combo, 'Candy' );
```
Appends an item to the combo box.
### `uiComboboxInsertAt( ... )`
### `uiNewCombobox( )`
```perl
my $combo = uiNewCombobox( );
```
Creates a new combo box.
## Editable Combobox Functions
An editable combobox is a control to select one item from a predefined list of items or enter ones own.
Predefined items can be selected from a drop down menu.
A customary item can be entered by the user via an editable text field.
You may import these functions with the `:editablecombobox` tag.
### `uiEditableComboboxAppend( ... )`
```
uiEditableComboboxAppend( $combo, 'Fire' );
```
Appends an item to the editable combo box.
### `uiEditableComboboxText( ... )`
eg/graph.pl view on Meta::CPAN
use v5.40;
use blib;
use LibUI qw[:all];
# Graph Demo - plots sin(x) from table data, redraws on edit
use constant PI => 3.14159265358979;
use constant { X_OFF_LEFT => 40, Y_OFF_TOP => 20, X_OFF_RIGHT => 20, Y_OFF_BOTTOM => 30, NUM_POINTS => 20 };
my $mainwin;
my $area;
my $combobox;
my @data_points; # spinbox widgets for y values
my @data_values; # current y values (cached)
my @functions = (
{ name => 'sin(x)', fn => sub { sin( $_[0] ) } },
{ name => 'cos(x)', fn => sub { cos( $_[0] ) } },
{ name => 'sin(x)+cos(x)/2', fn => sub { sin( $_[0] ) + cos( $_[0] ) / 2 } },
{ name => '|sin(x)|', fn => sub { abs( sin( $_[0] ) ) } },
{ name => 'x mod 3', fn => sub { $_[0] % 3 } }
);
my $current_fn = 0;
eg/graph.pl view on Meta::CPAN
uiBoxSetPadded( $hbox, 1 );
uiWindowSetChild( $mainwin, $hbox );
# Left panel: controls
my $ctrl = uiNewVerticalBox();
uiBoxSetPadded( $ctrl, 1 );
uiBoxAppend( $hbox, $ctrl, 0 );
# Function selector
uiBoxAppend( $ctrl, uiNewLabel('Function:'), 0 );
$combobox = uiNewCombobox();
for my $f (@functions) {
uiComboboxAppend( $combobox, $f->{name} );
}
uiComboboxSetSelected( $combobox, 0 );
uiComboboxOnSelected(
$combobox,
sub {
$current_fn = uiComboboxSelected($combobox);
refresh_values();
uiAreaQueueRedrawAll($area);
},
undef
);
uiBoxAppend( $ctrl, $combobox, 0 );
uiBoxAppend( $ctrl, uiNewHorizontalSeparator(), 0 );
uiBoxAppend( $ctrl, uiNewLabel('Data points (editable):'), 0 );
# Create spinboxes for data points
for my $i ( 0 .. NUM_POINTS - 1 ) {
my $sb = uiNewSpinbox( 0, 100 );
uiSpinboxOnChanged(
$sb,
sub {
$data_values[$i] = uiSpinboxValue($sb);
lib/LibUI.pm view on Meta::CPAN
group => [qw[ uiGroupTitle uiGroupSetTitle uiGroupSetChild uiGroupMargined uiGroupSetMargined uiNewGroup ]],
spinbox => [qw[ uiSpinboxValue uiSpinboxSetValue uiSpinboxOnChanged uiNewSpinbox ]],
slider => [
qw[
uiSliderValue uiSliderSetValue uiSliderHasToolTip uiSliderSetHasToolTip
uiSliderOnChanged uiSliderOnReleased uiSliderSetRange uiNewSlider
]
],
progressbar => [qw[uiProgressBarValue uiProgressBarSetValue uiNewProgressBar ]],
separator => [qw[uiNewHorizontalSeparator uiNewVerticalSeparator ]],
combobox => [
qw[
uiComboboxAppend uiComboboxInsertAt uiComboboxDelete uiComboboxClear
uiComboboxNumItems uiComboboxSelected uiComboboxSetSelected uiComboboxOnSelected
uiNewCombobox
]
],
editablecombobox => [
qw[
uiEditableComboboxAppend uiEditableComboboxText uiEditableComboboxSetText uiEditableComboboxOnChanged
uiNewEditableCombobox
]
],
menu => [
qw[
uiNewMenu uiMenuAppendItem uiMenuAppendCheckItem uiMenuAppendQuitItem
uiMenuAppendPreferencesItem uiMenuAppendAboutItem uiMenuAppendSeparator uiMenuItemEnable
uiMenuItemDisable uiMenuItemOnClicked uiMenuItemChecked uiMenuItemSetChecked
lib/LibUI.pm view on Meta::CPAN
UI_SELECTION_NONE UI_SELECTION_SINGLE UI_SELECTION_MULTIPLE
UI_SORT_NONE UI_SORT_ASCENDING UI_SORT_DESCENDING
UI_ALIGN_FILL UI_ALIGN_START UI_ALIGN_CENTER UI_ALIGN_END
]
],
helpers => [qw[solid_brush draw_stroke format_tm]]
);
{
my %seen;
push @{ $EXPORT_TAGS{control} }, grep { !$seen{$_}++ } @{ $EXPORT_TAGS{$_} }
for qw[area_extra attr attrstr box button checkbox colorbutton combobox constants datetimepicker
drawcontext drawmatrix drawpath drawstroke editablecombobox entry filedialog fontbutton form
grid group helpers image label menu misc msgbox multilineentry opentype progressbar radiobuttons
separator slider spinbox tab tab_extra table textlayout window];
}
{
my %seen;
push @{ $EXPORT_TAGS{all} }, grep { !$seen{$_}++ } @{ $EXPORT_TAGS{$_} } for keys %EXPORT_TAGS;
}
our @EXPORT_OK = @{ $EXPORT_TAGS{all} };
#~ use Data::Dump;
lib/LibUI.pod view on Meta::CPAN
Creates a new horizontal separator.
=head3 C<uiNewVerticalSeparator( )>
my $hsplit = uiNewVerticalSeparator( );
Creates a new vertical separator.
=head2 Combobox Functions
A combobox is a control to select one item from a predefined list of items via a drop down menu.
You may import these functions with the C<:combobox> tag.
=head3 C<uiComboboxAppend( ... )>
uiComboboxAppend( $combo, 'Candy' );
Appends an item to the combo box.
=head3 C<uiComboboxInsertAt( ... )>
uiComboboxInsertAt( $combo, 4, 'Salty snacks' );
lib/LibUI.pod view on Meta::CPAN
C<uiComboboxDelete( ... )>, or C<uiComboboxClear( ... )>.
=head3 C<uiNewCombobox( )>
my $combo = uiNewCombobox( );
Creates a new combo box.
=head2 Editable Combobox Functions
An editable combobox is a control to select one item from a predefined list of items or enter ones own.
Predefined items can be selected from a drop down menu.
A customary item can be entered by the user via an editable text field.
You may import these functions with the C<:editablecombobox> tag.
=head3 C<uiEditableComboboxAppend( ... )>
uiEditableComboboxAppend( $combo, 'Fire' );
Appends an item to the editable combo box.
=head3 C<uiEditableComboboxText( ... )>
my $text = uiEditableComboboxText( $combo );
lib/LibUI.pod view on Meta::CPAN
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
=head1 AUTHOR
Sanko Robinson L<https://github.com/sanko>
=begin stopwords
draggable gotta userdata borderless uiWindow uiBox resizable checkbox readonly spinbox combobox
=end stopwords
=cut
( run in 1.721 second using v1.01-cache-2.11-cpan-8dfa8b56332 )