class Iup::Label
A static control used to display some text or an image, or act as a separator.
Example
(1) label with text and setting font and colors:
Iup::Label.new("Iup Label Text") do |l| l.bgcolor = '255 255 0' l.fgcolor = '0 0 255' l.font = 'Courier, Normal 14' l.alignment = 'ACENTER' end
(2) label with image aligned to right
Iup::Label.new do |l| l.image = img_star end
(3) label as a horizontal separator
Iup::Label.new do |l| l.separator = 'HORIZONTAL' end
Attributes
Sets the horizontal and vertical alignment. The value is a string âhorizontal:verticalâ, with horizontal options ALEFT, ACENTER, ARIGHT and vertical options ATOP, ACENTER, ABOTTOM. Partial values also accepted, e.g. âARIGHTâ, â:ATOPâ.
If set, adds ââŚâ to the text if there is inadequate space, values âyesâ / ânoâ.
Allows label to fill available space in indicated direction. Values ânoâ / âhorizontalâ / âverticalâ / âyesâ.
Margin in x and y directions, value as âmxnâ.
Returns position in pixels within client window as âx,yâ.
Size of the label, in pixels, value as âwidthxheightâ.
returns position in pixels on screen as âx,yâ.
âhorizontalâ / âverticalâ, makes line into a line separator.
Space between image and text, value as a number.
Tooltip string.
text to display (unless label has an image or is a separator).
Public Class Methods
Source
# File lib/wrapped/label.rb, line 36 def initialize text=nil @handle = IupLib.IupLabel(text) # run any provided block on instance, to set up further attributes yield self if block_given? end
Creates an instance of a label. If a block is given, the new instance is yielded to it.
-
text- optional text to use for label.