Model Railroad System  2.2.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CabWidgets::SelectLocomotive Class Reference

Select or enter a Locomotive address. More...

Public Member Functions

 SelectLocomotive (name,...)
 Constructor. More...
 
 currentLocomotive ()
 Method to return the current locomotive address. More...
 
 invoke ()
 Method to invoke the widget. More...
 

Private Member Functions

 _trimList (option, value)
 Configure method for -maxsaved. More...
 
 _addnewloco ()
 Add new loco. More...
 

Private Attributes

 lf
 LabelFrame component. More...
 
 locoList
 Locolist Combobox component. More...
 

Detailed Description

Select or enter a Locomotive address.

This widget implements a Locomotive address selection widget. A Locomotive is selected from a drop down or a new address is entered. When a new address is entered, it is saved in the drop down list. The maximum number of saved addresses is configurable.

Parameters
pathPathname of the widget.
...Options:
  • -command Script to call when the address is changed. The new address is appended.
  • -maxsaved The maximum number of addresses to save. Default 6.
  • -label The label to use.
  • -labelwidth The width of the label.
  • -defaultlist The list of default loco addresses. Readonly. Default {3}.
Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ SelectLocomotive()

CabWidgets::SelectLocomotive::SelectLocomotive ( name  ,
  ... 
)

Constructor.

Parameters
pathWidget path.
...Options.

Member Function Documentation

◆ _addnewloco()

CabWidgets::SelectLocomotive::_addnewloco ( )
private

Add new loco.

Bound to the locoList ComboBox entry.

◆ _trimList()

CabWidgets::SelectLocomotive::_trimList ( option  ,
value   
)
private

Configure method for -maxsaved.

Trim the list if needed.

Parameters
optionThe option name.
valueThe new value.

◆ currentLocomotive()

CabWidgets::SelectLocomotive::currentLocomotive ( )

Method to return the current locomotive address.

◆ invoke()

CabWidgets::SelectLocomotive::invoke ( )

Method to invoke the widget.

This calls the script (if any) defined by the -command option.

Member Data Documentation

◆ lf

CabWidgets::SelectLocomotive::lf
private

LabelFrame component.

◆ locoList

CabWidgets::SelectLocomotive::locoList
private

Locolist Combobox component.