User Tools

Site Tools


Sidebar

Introduction

* Home

Documentation & help

LibreCAD Community

Help on DokuWiki

Temporary shorcuts

dev:v3:gui_api:dialog:inputgui1

This is an old revision of the document!


Input GUI Widgets I


Input GUI Class


Github Link

 namespace lc::ui::api 

The Input GUI class is the parent class of all input gui widgets (except button and checkbox) which is added to the dialog widget. This is an abstract class.


Label


Description

Get and set label for the Input GUI widget.

Examples

  •  message(input1:label()) 
  •  input1:setLabel("New Input GUI")

Enable and Disable


Description

Enable or disable the input gui widget.

Examples

  •  input1:enable() 
  •  input1:disable() 

Angle GUI Class


Github Link

 namespace lc::ui::api 

The Angle GUI class is used to enter an angle. Angle can be toggled between radians and degrees by clicking on the Rad/Deg button or by using the appropriate functions. Needs to be added to the dialog widget to be used.


Constructor


Description

Constructs an angle gui widget.

Examples

  •  local angle1 = gui.AngleGUI("Angle1") 

Get and Set Values


Description

Used to get the current value of the angle widget or set it to a desired value.

Note:- Always returns and expects the value to be in RADIANS . If the current display mode is in degrees, the angle is converted to degrees and displayed. When retrieving the mode dosen't matter, always returns in radians.

Examples

  •  local val = angle1:value() 
  •  angle1:setValue(1.56) 

To Degrees


Description

Used to switch the display mode to degrees, if the value is in radians it is automatically converted and shown in degrees.

Examples

  •  angle1:toDegrees() 

To Radians


Description

Used to switch the display mode to radians, if the value is in degrees it is automatically converted and shown in radians.

Examples

  •  angle1:toRadians() 

Add Finish Callback


Description

Add a finish callback which is called when the user presses enter after entering the angle or clicks somewhere else and the input gui loses focus. This is different from the dialog widget finish callback.

Examples

  •  angle1:addFinishCallback(function() message("Finished typing angle") end) 

Add On Change Callback


Description

Add an on change callback which is called when the user types anything i.e. on any change to the input.

Examples

  •  angle1:addOnChangeCallback(function() message(tostring(dialog1:value())) end) 

Button GUI Class


Github Link

 namespace lc::ui::api 

The Button GUI class is used to add a button to the dialog widget. Callbacks can be added to the button which is called when the button is clicked.


Constructor


Description

Constructs an button gui widget

Examples

  •  local button1 = gui.ButtonGUI("button1") 

Add Callback


Description

Add a callback to be called whenever the user clicks on the button.

Examples

  •  button1:addCallback(function() message("Button Clicked") end) 

dev/v3/gui_api/dialog/inputgui1.1594271801.txt.gz · Last modified: 2020/07/09 05:16 by jedi18