Radio Button Component - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Document Tools : Components : Radio Button Component

DocumentTools[Components]

  

RadioButton

  

generate XML for a RadioButton Component

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

RadioButton(caption, opts)

Parameters

caption

-

(optional) string:="RadioButton"; the caption on the radio button

opts

-

(optional) ; one or more keyword options as described below

Options

• 

action : string:=""; A string which parses to one or more valid statements in 1-D Maple notation. These statements form the Value Changed Action Component Code that executes when the RadioButton value is manually adjusted. The default is the empty string (no action code).

• 

enabled : truefalse; Indicates whether the component is enabled. The default is true. If enabled is false then the inserted component is grayed out and interaction with it cannot be initiated.

• 

fillcolor : {list(nonnegint),symbol,string}:=[255,255,255] ; Specifies the background color of the component. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [255,255,255] which corresponds to white.

• 

fontcolor : {list(nonnegint),symbol,string}:=[0,0,0] ; Specifies the font color of the component. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [0,0,0] which corresponds to black.

• 

group : string:=""; The name of the group with which this component is associated. The default is the empty string (no group).

• 

identity : {name,string}; The reference name of the component.

• 

selected : truefalse; Indicates whether the component is initially selected (checked). The default is false (unchecked).

• 

tooltip : string; The text that appears when the mouse pointer hovers over the component. The default is the empty string (no tooltip).

• 

visible : truefalse; Indicates whether the component is visible. The default is true.

Description

• 

The RadioButton command in the Component Constructors package returns an XML function call which represents a RadioButton Component.

• 

The generated XML can be used with the results of commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document can be inserted into the current document using the InsertContent command.

Examples

withDocumentTools:

withDocumentTools:-Components:

withDocumentTools:-Layout:

Executing the RadioButton command produces a function call.

SRadioButtonidentity=RadioButton0

S_XML_EC-RadioButtonid=RadioButton0,caption=RadioButton,selected=false,groupname=,enabled=true,fillcolor=[255,255,255],fontcolor=[0,0,0],visible=true

(1)

By using commands from the Layout Constructors package a nested function call can be produced which represents a worksheet.

xmlWorksheetGroupInputTextfieldS:

That XML representation of a worksheet can be inserted directly.

InsertContentxml:

The previous example's call to the InsertContent command inserted a component with identity "RadioButton0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "RadioButton0" incurs a substitution of the input identity in order to avoid a conflict with the identity of the existing component.

In the next example, all three button's identities can be replaced by substitution, as a chain of consequences. The first button with caption "A" has its identity replaced to avoid a conflict with the button inserted in the previous example. The second button with caption "B" can have its identity replaced to avoid a conflict with the new, substituted identity of button "A". Button "C" can have its identity replaced to avoid a conflict with the new, substituted identity of button "B".

S1RadioButtonA,identity=RadioButton0,selected,group=mygroup:

S2RadioButtonB,identity=RadioButton1,group=mygroup:

S3RadioButtonC,identity=RadioButton2,group=mygroup:

xmlWorksheetGroupInputTextfieldS1,S2,S3:

The return value of the following call to InsertContent is a table which can be used to reference the substituted identities of the inserted components.

lookupInsertContentxml,output=table

lookuptableRadioButton0=RadioButton1,RadioButton2=RadioButton3,RadioButton1=RadioButton2

(2)

seqlookupb,b=RadioButton0,RadioButton1,RadioButton2

RadioButton1,RadioButton2,RadioButton3

(3)

seqGetPropertylookupb,value,b=RadioButton0,RadioButton1,RadioButton2

true,false,false

(4)

The next example makes use of action code for a pair of grouped radio buttons. When either radio button is manually selected the respective action code is executed.

The action code updates a PlotComponent with identity "Plot0", which will be an additional part of the inserted content. This component will be constructed using the Plot Component constructor.

pplotsinx,x=2π..2π:

PComponents:-Plotp,identity=Plot0:

Each action code consists of multi-line statements supplied as a string.

actioncodecDocumentTools:-SetProperty(':-Plot0',value,\n plots:-display(p,scaling=constrained));:

actioncodeuDocumentTools:-SetProperty(':-Plot0',value,\n plots:-display(p,scaling=unconstrained));:

S1RadioButtonconstrained,identity=RB0,group=newgroup,action=actioncodec:

S2RadioButtonunconstrained,identity=RB1,selected,group=newgroup,action=actioncodeu:

xmlWorksheetGroupInputTextfieldP,GroupInputTextfieldS1,S2:

Following insertion either radio button can be manually selected, which causes the respective action code to execute and the "Plot0" component to be updated.

InsertContentxml:

S1RadioButtonconstrained,identity=RB0,group=newgroup,action=actioncodec,fillcolor=LightBlue,fontcolor=Blue:S2RadioButtonunconstrained,identity=RB1,selected,group=newgroup,action=actioncodeu,fillcolor=LightBlue,fontcolor=Blue:xmlWorksheetTableinterior=none,width=500,widthmode=pixels,Column,RowCellTextfieldP,fillcolor=LightBlue,RowCellTextfieldS1,S2,fillcolor=LightBlue:

InsertContentxml:

Compatibility

• 

The DocumentTools:-Components:-RadioButton command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The DocumentTools:-Components:-RadioButton command was updated in Maple 2016.

• 

The fillcolor and fontcolor options were introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

Component Code

Component Constructors

DocumentTools

Embedded Components

Layout Constructors

XMLTools