User Tools

Site Tools


Sidebar

Introduction

* Home

Documentation & help

LibreCAD Community

Help on DokuWiki

Temporary shorcuts

dev:v3:gui_api:dialog:inputgui2

Input GUI Widgets II


Coordinate GUI Class


Github Link

 namespace lc::ui::api 

The Coordinate GUI widget allows the user to select a coordinate either by selecting the point using the mouse or by entering the coordinate into the widget. Clicking on the select point button allows the user to select a point using the mouse.


Constructor


Description

Constructs an Coordinate GUI widget.

Examples

  •  local coord1 = gui.Coordinate("Coordinate1") 

Get and Set Values


Description

Used to get the current value of the coordinate widget or set it to a desired value. A lc::geo::Coordinate object is returned/expected by the widget.

Examples

  •  local point1 = coord1:value()
     lineBuilder:setLastPoint(point1) 
  •  coord1:setValue(lc.geo.Coordinate(24,52)) 

Add Finish Callback


Description

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

Examples

  •  coord1:addFinishCallback(function() message("Finished entering coordinate") 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 coordinate input.

Examples

  •  coord1:addOnChangeCallback(function() message(tostring(coord1:value())) end) 

Entity Picker GUI Class


Github Link

 namespace lc::ui::api 

The entity picker gui widget allows the user to select an entity by dragging their mouse and selecting the required entities which are then added to the entity list. Selecting an entity from the list highlights it in the cadmdichild so the user can see which entity it refers to.


Constructor


Description

Constructs an Entity Picker GUI widget.

Examples

  •  local entity1 = gui.EntityPicker("Entity1") 

Get Values


Description

Get a list of all the entity selected using the entity picker widget. It returns a list of cadentity shared pointers.

Examples

  •  local entities = entity1:value() 

Set Value


Description

An entity list is passed in as a parameter and all these entities are added to the list (unless entity is already added to the list).

Examples

  •  entity1:setValue(entitiesList) 

Add Callback


Description

Add callback for when an entity is selected in the entity list.

Examples

  •  entity1:addCallback(function(selectedEntity) message("An entity has been selected in the list") end) 

Add Entity


Description

Add an entity to the entity list.

Examples

  •  entity1:addEntity(lineEntity) 

Number GUI Class


Github Link

 namespace lc::ui::api 

The number gui widget is used for entering a number (double).


Constructor


Description

Constructs a Number GUI widget.

Examples

  •  local number1 = gui.Number("Number1") 

Get Values


Description

Gets the value of the number widget.

Examples

  •  local val = number1:value() 

Set Value


Description

Sets the number widget value.

Examples

  •  number1:setValue(2.4) 

Add Callback


Description

Add callback for when the number is changed

Examples

  •  number1:addCallback(function(num) message(tostring(num)) end) 

Slider GUI Class


Github Link

 namespace lc::ui::api 

The slider gui widget is used for values that could use a slider input.


Constructor


Description

Constructs a Slider GUI Widget.

Examples

  •  local slider1 = gui.Slider("Slider1") 

Get Values


Description

Gets the value of the slider widget. Returns a double value.

Examples

  •  local val = slider1:value() 

Set Value


Description

Sets the slider widget value. Expects a double parameter.

Examples

  •  slider1:setValue(2.4) 

Add Callback


Description

Add callback for when the slider value is changed.

Examples

  •  slider1:addCallback(function(num) message(tostring(num)) end) 

dev/v3/gui_api/dialog/inputgui2.txt · Last modified: 2020/07/09 12:41 by jedi18