User Tools

Site Tools


label

Label (QLabel)

www.kbasic.com_images_label.jpg

The Qt documentation in C++ of this class can be read here: http://doc.trolltech.com/4.3/qlabel.html

A control for the form object, provides a text or image display.

It is used for displaying text or an image. No user interaction functionality is provided. You can display HTML text with it too.

Most important

Methods None
Properties Icon , Caption
Events None

Please read the control class overview Control as well.

PROPERTIES

Shape

Property Shape As Boolean (ReadWrite)

If it is true, a shape appears behind the label.


Property OpenLinks As Boolean (ReadWrite)

If it is true, the label opens the default browser, when Caption contains link in HTML code, which was clicked by the user. The label will look like a link only at runtime. In the form designer it will lool like any ordinary label.

Set the following properties:

Caption = www.kbasic.com
OpenLinks = True
Feature = LinksAccessibleByMouse;

WordWrap

Property WordWrap As Boolean (ReadWrite)

If it is true, Label shows its Caption in several lines.


Scale

Property Scale As Boolean (ReadWrite)

If it is true, the image of the label is show as big as the geometry of label is. The text of the label is not affected.


Alignment

Property Alignment As String (ReadWrite)

How Caption should be displayed? Should it be on top inside the boundaries of the control for example?


Feature

Property Feature As String (ReadWrite)

How Caption should be displayed?


InputControl

Property InputControl As String (ReadOnly)

When the user presses the shortcut key indicated by this label, the keyboard focus is transferred to the Control defined by InputControl.

This mechanism is only available for Labels that contain plain text in which one letter is prefixed with an ampersand, &. This letter is set as the shortcut key. The letter is displayed underlined, and the '&' is not displayed, but only at runtime. At runtime you must hit ALT+Letter, e.g. ALT+F if you have ”&Find” as label text.


Icon

Property Icon As String (ReadWrite)

Either an icon or caption is visible. If you set an icon, the caption will not be displayed. An icon can be an absolute path to an image file (png, jpg,…) like c:\myfolder\myimage.png or can be an relative path to the current project like myimage.png (which is present in the current project directory). Relative paths are recommended.

Might be a String containing binary data. See the binary project example for using.

Example

Dim c As Label
c = Control("Label0") ' Label0 is declared as CommandButton in this form
c.Icon = "tux.jpg" ' relative path. File exists in current project directory

See also Caption


Caption

Property Caption As String (ReadWrite)

Holds the text to be displayed.

Example

Dim c As Label0
c = Control("Label0") ' Label0 is declared as CommandButton in this form
c.Caption = "Hello World!"

See also Icon


Value

Property Value As String (ReadWrite)

Same as Caption. Provided for easy-use.


Text

Property Text As String (ReadWrite)

Same as Caption. Provided for easy-use.


Enabled

Property Enabled As Boolean(ReadWrite)

Implemented since KBasic V1.8


label.txt · Last modified: 2013/06/04 13:54 by berndnoetscher