Difference between revisions of "Label"

From AutoIt Wiki
Jump to navigation Jump to search
m (BrokenLinks(FunctionList): ...)
Line 1: Line 1:
A Label is simple, plain piece of text appearing in [[Graphical User Interface|GUI]].
+
A Label is a simple, plain piece of text appearing in a [[Graphical User Interface|GUI]].
  
  
 
== Summary ==
 
== Summary ==
Label is GUI control, which consists of simple, plain piece of text. The function for creating Label is {{Help File|GuiCtrlCreateLabel}}. You can change text using {{Help File|GuiCtrlSetData}} and read it using {{Help File|GuiCtrlRead}} functions.
+
A Label is a GUI control, which consists of a simple, plain piece of text. The function for creating a Label is {{Help File|GuiCtrlCreateLabel}}. You can change the text of the label using {{Help File|GuiCtrlSetData}} and read it using {{Help File|GuiCtrlRead}} functions.
  
  
Line 20: Line 20:
 
     GUISetHelp("notepad") ; will run notepad if F1 is typed
 
     GUISetHelp("notepad") ; will run notepad if F1 is typed
  
     Local Const $iOldOpt = Opt("GUICoordMode", 2)
+
     Opt("GUICoordMode", 2)
  
 
     Local Const $widthCell = 70
 
     Local Const $widthCell = 70
Line 33: Line 33:
  
 
     ; Run the GUI until the dialog is closed
 
     ; Run the GUI until the dialog is closed
    Local $msg
 
 
 
     Do
 
     Do
        $msg = GUIGetMsg()
+
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    Until $msg = $GUI_EVENT_CLOSE
 
  
    Opt("GUICoordMode", $iOldOpt)
 
 
  EndFunc  ;==>Example
 
  EndFunc  ;==>Example
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 17:49, 15 January 2013

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


Summary

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


Example

This example demonstrates the creation of a GUI label.

 #include <GUIConstantsEx.au3>

 Opt('MustDeclareVars', 1)

 Example()

 Func Example()
     GUICreate("My GUI") ; will create a dialog box that when displayed is centered

     GUISetHelp("notepad") ; will run notepad if F1 is typed

     Opt("GUICoordMode", 2)

     Local Const $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
     Until GUIGetMsg() = $GUI_EVENT_CLOSE

 EndFunc   ;==>Example