Index | Collapse All Expand All

GetSelectedText Method
Label Class Members Examples See Also

Beta Documentation - Subject to change.
Gets the selected text of the label.

# Syntax

Lua
    function Label:GetSelectedText();

#### Returns

Type: string
The selected text of the label.

# Remarks

Gets the selected text of the label. The selected text remains selected only while the label has the focus of the mouse. Once focus is lost, the previously selected text is unselected.

# Examples

This example echoes the selected text from a label.

Displaying Selected Text | Copy Code
--- | ---
            import "Turbine.UI.Lotro";

            window = Turbine.UI.Lotro.Window();
            window:SetPosition( 200, 200 );
            window:SetSize( 200, 200 );
            window:SetText( "Test" );
            window:SetVisible( true );

            label = Turbine.UI.Label();
            label:SetParent( window );
            label:SetSeletable( true );
            label:SetPosition( 40, 60 );
            label:SetSize( 120, 80 );
            label:SetBackColor( Turbine.UI.Color( 0.2, 0.2, 0.2 ) );
            label:SetText( "Hello world!" );
            label:SetTextAlignment( Turbine.UI.ContentAlignment.MiddleCenter );

            label.MouseLeave = function( sender, args )
              Turbine.Shell.WriteLine( label:GetSelectedText() );
            end

# See Also

- Label
- Turbine.UI