Label

From AutoIt Wiki
Revision as of 13:44, 18 October 2008 by I542 (talk | contribs) (Page Created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A Label is simple, plain piece of text appearing in GUI.


Summary

Label is GUI control, which consists of simple, plain piece of text. The function for creating Label is GuiCtrlCreateLabel. You can change text using GuiCtrlSetData and read it using GuiCtrlRead functions.


Example

This example shows creating of an GUI Label.

   #include <GUIConstantsEx.au3>
   Opt('MustDeclareVars', 1)
   Example()
   Func Example()
       Local $widthCell, $msg, $iOldOpt
       GUICreate("My GUI")  ; will create a dialog box that when displayed is centered
       GUISetHelp("notepad")  ; will run notepad if F1 is typed
       $iOldOpt = Opt("GUICoordMode", 2)
       $widthCell = 70
       GUICtrlCreateLabel("Line 1 Cell 1", 10, 30, $widthCell) ; first cell 70 width
       GUICtrlCreateLabel("Line 2 Cell 1", -1, 0) ; next line
       GUICtrlCreateLabel("Line 3 Cell 2", 0, 0) ; next line and next cell
       GUICtrlCreateLabel("Line 3 Cell 3", 0, -1) ; next cell same line
       GUICtrlCreateLabel("Line 4 Cell 1", -3 * $widthCell, 0) ; next line Cell1
       GUISetState()      ; will display an empty dialog box
       ; Run the GUI until the dialog is closed
       Do
           $msg = GUIGetMsg()
       Until $msg = $GUI_EVENT_CLOSE
       $iOldOpt = Opt("GUICoordMode", $iOldOpt)
   EndFunc   ;==>Example