Application Developer Guide > Using the Widget Toolbox > Setting and Getting Resources
  

Setting and Getting Resources
You can change the way a widget appears or behaves by specifying values for resources used by the widget.
Resources are specified using an unnamed structure with each tag name representing the resource name and each tag definition representing the resource value.
An unnamed structure has the following general definition:
x = {, tag_name1: tag_def1, tag_namen: tag_defn}
For detailed information on unnamed structures, see "Creating Unnamed Structures" of the PV-WAVE 10.0 Programmer’s Guide.
A resource name is a string indicating the type of resource. The name of a Widget Toolbox widget is derived directly from Motif resource names. Motif resource names are listed in the OSF/Motif Programmer’s Guide.
Remove the XmN prefix from the Motif resource names. Naming Convention lists examples of how the name of the Widget Toolbox widget is derived from the Motif resource name.
 
Table 6-1: Naming Convention
Motif Resource
Widget Toolbox Resource
XmNx
x
XmNy
y
XmNlabel
label
XmNforeground
foreground
The data type of a resource’s value depends on the type of the resource.
Example
; Create unnamed structure containing resource names and values.
args={,x: 30, y: 50, label:'Done', foreground: 'red'}
; Create a pushbutton widget and use the args structure to
; specify its resources.
wid=wtcreate('button', xmPushButtonWidgetClass, parent, args)
See the example at the end of this section.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.