Pinnacle : Widgets (Menus)
Description
Widgets are parts of user-generated menus. All menus are comprised of a full canvas that’s divided down into individual parts (widget classes). These widgets have different appearances and perform different actions.
Uses
Colors
QueryColorKey = "blue"; // Sets color of buttons
Classes
ArrowRight | ArrowLeft | ArrowUp | ArrowDown | Canvas | CascadeButton | ComboBox |
ColorIcon | Dial | DismissButton | DrawingArea | EntryField | Form | Frame |
HelpButton | Icon | Label | List | ListTree | MenuBar | MultiList |
MultiText | OptionMenu | Panel | Plot | PushButton | RadioBox | RadioBoxHorizontal |
Scale | ScaleHorizontal | ScrollBar | ScrollBarHorizontal | ScrolledWindow | Separator | StatusDial |
TabList | Text | ToggleButton/Checkbox | TrueFalse | TrueFalseHorizontal | VerticalSeparator | WarningLabel |
XText | YesNo | YesNoHorizontal |
[1]
Examples
ArrowDown
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ArrowDown";
ParentName = "SomeParent";
Name = "Arrow";
X = 170;
Y = 100;
AddAction = "";
ReplaceCurrentAction = "Script.ExecuteNow = /usr/local/adacnew/PinnacleSiteData/Scripts/Example.Script";
};
ArrowLeft
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ArrowLeft";
ParentName = "SomeParent";
Name = "Arrow";
X = 170;
Y = 100;
AddAction = "";
ReplaceCurrentAction = "Script.ExecuteNow = /usr/local/adacnew/PinnacleSiteData/Scripts/Example.Script";
};
ArrowRight
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ArrowRight";
ParentName = "SomeParent";
Name = "Arrow";
X = 170;
Y = 100;
AddAction = "";
ReplaceCurrentAction = "Script.ExecuteNow = /usr/local/adacnew/PinnacleSiteData/Scripts/Example.Script";
};
ArrowUp
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ArrowUp";
ParentName = "SomeParent";
Name = "Arrow";
X = 170;
Y = 100;
AddAction = "";
ReplaceCurrentAction = "Script.ExecuteNow = /usr/local/adacnew/PinnacleSiteData/Scripts/Example.Script";
};
ComboBox
- This seems to lock my session if I use it like an OptionMenu (i.e. replace “OptionMenu” with “ComboBox” in “WidgetClass = “
Dial
- Specify a variable between 0 and 100. 25=3 o’clock, 50=6 o’clock, etc.
- Use “QueryValueKey” to set the hand position.
- Can be updated in real-time (see StatusDial for example).
//Value between 0 and 100, 25=3 o'clock, 50=6 o'clock, etc
Store.FloatAt.ScaleVal = 90;
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Dial";
ParentName = "ScrollRegion";
Name = "DialTest";
X = 165;
Y = 55;
Width = 100;
Height = 100;
QueryValueKey = "Store.FloatAt.ScaleVal";
ResetDependenciesWhenRealized = 1;
};
Dismiss Button
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "DismissButton";
ParentName = "SomeParent";
Name = "DismissButton";
X = 5;
Y = 5;
AddAction = "";
ReplaceCurrentAction = "Store.At.TempWindow.Unrealize";
AddAction = "";
Label = "Dismiss";
AddAction = "";
ReplaceCurrentAction = "Store.FreeAt.TempWindow";
};
List
- Height parameter describes how many items are visible at one time
- If additional items exist in the list, then a scrollbar appears.
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "List";
ParentName = "ScrollRegion";
Name = "ListTest";
X = 150;
Y = 80;
Width = 120;
Height = 3; //Number of items to be displayed in list at one time. If more items, scrollbar appears.
//AddLabelToStartOfList=1;//Not needed unless something needs to be added to the list
//Label="TestLinac";
QueryListKey = "TrialList.Current.BeamList.*.Name";
QueryValueKey = "TrialList.Current.BeamList.Current.Name";
AddAction = "";
ReplaceCurrentAction = "TrialList.Current.BeamList.Current";
AddAction= "";
ReplaceCurrentAction = "Store.StringAt.BName";
AddAction = "";
ReplaceCurrentAction = "InfoMessage=Store.StringAt.BName";
ResetDependenciesWhenRealized = 1;
};
Label
- Labels can be specified using strings, floats or hardcoded
- Generic Pinnacle colors can be used
- “ResetDependenciesWhenRealized=1” allows the label to update automatically when the variable changes. This isn’t necessary.
//These variables can be defined in the script or another files
Store.FloatAt.LabelFloat = 23432;
Store.StringAt.LabelString = "This is a string variable";
//Example of a Float Label
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Label";
ParentName = "ScrollRegion";
Name = "FloatLabel";
X = 130;
Y = 70;
Width = 100;
UseQueryForLabel = 1;
UseDefaultSize = 1;
QueryValueKey = "Store.FloatAt.LabelFloat";
ResetDependenciesWhenRealized = 1;
};
//Example of a hardcoded label
//Set "Name = " to the text to be displayed
//Remove QueryValueKey
//Colors can be used
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Label";
ParentName = "ScrollRegion";
Name = "This is a label name";
X = 130;
Y = 90;
Width = 100;
UseQueryForLabel = 1;
UseDefaultSize = 1;
QueryColorKey = "blue";
ResetDependenciesWhenRealized = 1;
};
//Example of a label using a string variable
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Label";
ParentName = "ScrollRegion";
Name = "StringLabel";
X = 130;
Y = 110;
Width = 100;
UseQueryForLabel = 1;
UseDefaultSize = 1;
QueryValueKey = "Store.StringAt.LabelString";
ResetDependenciesWhenRealized = 1;
};
PushButton
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "PushButton";
ParentName = "SomeParent";
Name = "PushButton";
X = 175;
Y = 100;
Width = 100;
Height = 30;
AddAction = "";
ReplaceCurrentAction = "Script.ExecuteNow = /usr/local/adacnew/PinnacleSiteData/Scripts/Some.Script";
};
RadioBox
- This widget is very similar to an OptionMenu (see OptionMenu for another example that does change current active parameters)
- QueryListKey contains RadioBox Options
- Height/Width do not seem to matter
- Can add an extra option with “AddLabelToStartofList=1;”
- The example below uses a RadioBox to select the current beam, writes the beam name to a variable, then outputs it with InfoMessage.
- It is linked to the plan so if a beam is selected manually without using the RadioBox, the current RadioBox option will update.
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "RadioBox";
ParentName = "ScrollRegion";
Name = "RadioBoxTest";
X = 150;
Y = 55;
Width = 100;
Height = 100;
//AddLabelToStartOfList=1;//Not needed unless something needs to be added ot the list
//Label="TestLinac";
QueryListKey = "TrialList.Current.BeamList.*.Name";
QueryValueKey = "TrialList.Current.BeamList.Current.Name";
AddAction = "";
ReplaceCurrentAction = "TrialList.Current.BeamList.Current";
AddAction= "";
ReplaceCurrentAction = "Store.StringAt.BName";
AddAction = "";
ReplaceCurrentAction = "InfoMessage=Store.StringAt.BName";
ResetDependenciesWhenRealized = 1;
};
RadioBoxHorizontal
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "RadioBoxHorizontal";
ParentName = "ScrollRegion";
Name = "RadioBoxTest";
X = 20;
Y = 90;
Width = 100;
Height = 100;
//AddLabelToStartOfList=1;//Not needed unless something needs to be added ot the list
//Label="TestLinac";
QueryListKey = "TrialList.Current.BeamList.*.Name";
QueryValueKey = "TrialList.Current.BeamList.Current.Name";
AddAction = "";
ReplaceCurrentAction = "TrialList.Current.BeamList.Current";
AddAction= "";
ReplaceCurrentAction = "Store.StringAt.BName";
AddAction = "";
ReplaceCurrentAction = "InfoMessage=Store.StringAt.BName";
ResetDependenciesWhenRealized = 1;
};
Scale
- This doesn’t seem to work well if the an “AddAction/ReplaceCurrentAction” is used for anything other than storing the variable (as shown below).
- The example below shows utilization of the Scale Widget with a Label Widget. A different widget, like a PushButton widget, may be used to perform an action after the scale value is selected.
- See StatusDial for another example using ScaleHorizonal
//Must declare a variable to store the scale value somewhere. The top of the menu script or another file will work.
//Scale from 0 to 100, the slider will show up at the specified float value (i.e. 0 = top, 50=middle, 100=bottom)
Store.FloatAt.ScaleValue=50;
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Scale";
ParentName = "SomeParent";
Name = "ScaleTest";
X = 200;
Y = 60;
Width = 20;
Height = 100;
QueryValueKey="Store.FloatAt.ScaleValue";
AddAction = "";
ReplaceCurrentAction = "Store.FloatAt.ScaleValue";
//AddAction = "";
//ReplaceCurrentAction = "InfoMessage=Store.FloatAt.ScaleValue"; //This causes issues, it's called every time the value is refreshed.
};
//This widget is used as an example of how to display the Scale value. Other possibilities like a PushButton can be used to utilize the value.
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Label";
ParentName = "SomeParent";
Name = "ScaleValueLabel";
X = 230;
Y = 100;
Width = 100;
UseQueryForLabel = 1;
UseDefaultSize = 1;
QueryValueKey = "Store.FloatAt.ScaleValue";
ResetDependenciesWhenRealized = 1;
};
ScaleHorizontal
- This doesn’t seem to work well if the an “AddAction/ReplaceCurrentAction” is used for anything other than storing the variable (as shown below).
- The example below shows utilization of the Scale Widget with a Label Widget. A different widget, like a PushButton widget, may be used to perform an action after the scale value is selected.
- See StatusDial for another example
//Must declare a variable to store the scale value somewhere. The top of the menu script or another file will work.
//Scale from 0 to 100, the slider will show up at the specified float value (i.e. 0 = top, 50=middle, 100=bottom)
Store.FloatAt.ScaleValue=50;
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ScaleHorizontal";
ParentName = "SomeParent";
Name = "ScaleTest";
X = 200;
Y = 60;
Width = 20;
Height = 100;
QueryValueKey="Store.FloatAt.ScaleValue";
AddAction = "";
ReplaceCurrentAction = "Store.FloatAt.ScaleValue";
//AddAction = "";
//ReplaceCurrentAction = "InfoMessage=Store.FloatAt.ScaleValue";
//This causes issues. It's called every time the value is refreshed, which is almost constantly.
};
//This widget is used as an example of how to display the Scale value.
// Other possibilities like a PushButton can be used to utilize the value returned from the Scale widget.
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "Label";
ParentName = "SomeParent";
Name = "ScaleValueLabel";
X = 230;
Y = 100;
Width = 100;
UseQueryForLabel = 1;
UseDefaultSize = 1;
QueryValueKey = "Store.FloatAt.ScaleValue";
ResetDependenciesWhenRealized = 1;
};
Separator
Store.At.TempWindow.AddChild = "";
Store.At.TempWindow.WidgetList.Last = {
WidgetClass = "Separator";
ParentName = "SomeParent";
Name = "Sep";
X = 30;
Y = 100;
Width = 300;
Height = 5;
};
StatusDial
- Define the position of the StatusDial using “QueryValueKey”
- The StatusDial widget can update in real-time
- The example below combines the StatusDial widget with the Scale widget.
Store.FloatAt.ScaleVal = 90; //Can define a variable to set dial location
//StatusDial widget example
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "StatusDial";
ParentName = "ScrollRegion";
Name = "StatusDialTest";
X = 165;
Y = 30;
Width = 100;
Height = 100;
QueryValueKey = "Store.FloatAt.ScaleVal"; //This value controls the StatusDial location
ResetDependenciesWhenRealized = 1;//This is necessary for real-time updates
//Scale Widget Example
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ScaleHorizontal";
ParentName = "ScrollRegion";
Name = "ScaleTest";
X = 140;
Y = 150;
Width = 150;
Height = 30;
QueryValueKey = "Store.FloatAt.ScaleVal"; //This value is used to the define the scale location.
AddAction = "";
ReplaceCurrentAction = "Store.FloatAt.ScaleVal";
ResetDependenciesWhenRealized = 1;
};
};
ToggleButton (Checkbox)
- Returns either a 1 (checked) or 0 (unchecked)
- Width and Height control Checkbox size
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "ToggleButton";
ParentName = "ScrollRegion";
Name = "Checkbox";
X = 200;
Y = 90;
Width = 20;
Height = 20;
QueryValueKey="Store.FloatAt.CheckboxValue";
AddAction = "";
ReplaceCurrentAction = "Store.FloatAt.CheckboxValue";
AddAction = "";
ReplaceCurrentAction = "InfoMessage=Store.FloatAt.CheckboxValue";
};
VerticalSeparator
Store.At.TempWindow.AddChild = "";
Store.At.TempWindow.WidgetList.Last = {
WidgetClass = "VerticalSeparator";
ParentName = "SomeParent";
Name = "VertSep";
X = 225;
Y = 10;
Width = 5;
Height = 300;
};
ColorIcon
Add a user-supplied image to a pop-up menu[2]
1) Convert your image to .xpm format (Sites that do this are available online – Example 1, 2, 3)
2) Upload the .xpm file to the Pinnacle system
3) Using the example below, set “Store.String.At.LogoPath” as the location of .xpm image.
4) QueryValueKey does not seem to work using the full file path (i.e. /usr/local/….) instead of Store.StringAt.xxxxxx.
5) UseDefaultSize=1 must be used, Height and Width don’t seem to do anything.
Store.StringAt.LogoPath = "/usr/local/adacnew/PinnacleSiteData/Scripts/Menus";
Store.At.LogoPath.AppendString = "/TPSWiki.xpm";
Store.At.TempWindow.AddChild = "";
Store.At.TempWindow.WidgetList.Last = {
ParentName = "TopLevel";
WidgetClass = "ColorIcon";
X = 2;
Y = 2;
UseDefaultSize = 1;
QueryValueKey = "Store.StringAt.LogoPath";
UseQueryForLabel = 1;
//Turn the icon into a button
AddAction="";
ReplaceCurrentAction="SomeCommandToBeExecuted";
}
OptionMenu
- QueryListKey specifies the list that is displayed in the OptionMenu (e.g. linacs, energies, ROIs, a custom list, etc).
- The example below uses two OptionMenus. The first lets the user choose a linac, the second lets the user select the corresponding energy
- The result is written to a variable and output using InfoMessage
- See the RadioBox example to directly alter plan data (e.g. select a linac using the widget that is then selected in the plan).
- ResetDependenciesWhenRealized=1; is needed for the real-time changes to the OptionMenu appearance
- See
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "OptionMenu";
ParentName = "ScrollRegion";
Name = "OptionMenuTest";
X = 145;
Y = 55;
Width = 100;
Height = 100;
AddLabelToStartOfList=1;//Not needed unless something needs to be added to the list at the top
Label="TestLinac";//Not needed unless something needs to be added to the list at the top
QueryListKey = "MachineList.*.Name";//This is the list the OptionMenu widget pulls from.
QueryValueKey = "Store.StringAt.MachName";
AddAction = "";
ReplaceCurrentAction = "Store.StringAt.MachName";//Sets the selected menu item (if this is missing it doesn't change)
AddAction = "";
ReplaceCurrentAction = "MachineList.Current"; //Sets the actual MachineList to the currently selected menu option
ResetDependenciesWhenRealized = 1;
};
Store .At .TempWindow .AddChild = "";
Store .At .TempWindow .WidgetList.Last = {
WidgetClass = "OptionMenu";
ParentName = "ScrollRegion";
Name = "ETest";
X = 145;
Y = 95;
Width = 100;
Height = 100;
QueryListKey = "MachineList.Current.PhotonEnergyList.*.Name";
QueryValueKey = "Store.StringAt.EnergyName";
AddAction = "";
ReplaceCurrentAction = "Store.StringAt.EnergyName";
AddAction = "";
ReplaceCurrentAction = "InfoMessage = Store.StringAt.EnergyName";
ResetDependenciesWhenRealized = 1;
};