Foundation > The Display System > Display System Resources
 
Display System Resources
A display system resource is an association of two strings: a name and a value. Display system resources are very convenient for building customizable applications.
Note: “Display system” resources are not to be confused with “graphic” resources, which are described in Chapter 3, Graphic Resources.
The resource name-value pair can be specified as follows in specific sections of a resource file (the .Xdefaults file on UNIX or the .INI file on PCs, for example):
[MyApplication]
view.background=green
label.txt=This is my contents
The value associated with the resource name can be modified by the end user at run time.
Note: Resource files have an [Views] section that is common to all Rogue Wave Views applications.
More details on display system resources are in the topics:
*The getResource Method
*How Display System Resources are Stored
*Default Display System Resources
*Environment Variables and Resource Names
*Display System Resources on Windows
The getResource Method
The application uses the getResource method to retrieve a resource value from the display system.
const char* res = display->getResource("resourceName", default);
The method getResource returns a value string associated with the application name of the current Rogue Wave Views session, which is specified in the IlvDisplay constructor, and the string representing the resource name. If no resource matches the given string, then this member function returns the default value provided in the optional default string parameter. The only type returned by getResource is const char*. It is up to the application programmer to convert the string to another data type. The place in memory where the result of an getResource call is stored gets reused each time you call the function. Thus, the previous result is overwritten. If you want to save your result, you must recopy it right away.
How Display System Resources are Stored
The way resources are stored within your display system configuration files is system-dependent.
*With Microsoft Windows, you must add the following line to the VIEWS.INI file or the application-dependent .INI file. (The VIEWS.INI file can be found in the Windows directory.)
[AppName]
myDialogTitle=Load file
*On the X Window system, you must pass the following line to the resource manager:
AppName*myDialogTitle: Load file
You can use the xrdb program or include it into a file read by X clients (the .Xdefaults file or the file specified by your XENVIRONMENT variable).
Default Display System Resources
When an instance of the IlvDisplay class is created, the default display system resources are initialized using the system resources mechanism:
IlvDisplay Default Resources
IlvDisplay Method
System Resource Name
Default Value
foreground
black
background
gray
font
system-dependent
normalfont
system-dependent
boldfont
system-dependent
italicfont
system-dependent
largefont
system-dependent
Environment Variables and Resource Names
Default UNIX and PC environment variables have precedence over the resource name specified in resource files (namely .Xdefault, and .INI). The following table gives a list of environment variables with their associated resource names.
Environment Variables and Resource Names
Environment Variable Name
Resource Name
ILVHOME
home.
For details see the section Home.
ILVLANG
lang.
For more information, see the section The IlvMessageDatabase Class.
ILVDB
messageDB.
For more information, see the section The IlvMessageDatabase Class.
ILVLOOK
look.
The look resource takes either one of the following values: motif, vx, windows, win95, or winxp. For more information, refer to the Gadgets documentation.
Display System Resources on Windows
On the Microsoft Windows environment, you can define Windows-specific resources in addition to the standard resources. These resources are listed below:
*[TTY]  If this resource is set to TRUE, a message window is created to which all Rogue Wave Views messages are sent. The default value is FALSE.
*[TTYw], [TTYh],
[TTYx], [TTYy]  These resources specify the size and position of the message window, provided that TTY is set to TRUE. The default values are TTYw=200, TTYh=100, TTYx=screen_width‑TTYw, TTYy=screen_height‑TTYh.
*[UseRightButton]  If this resource is set to TRUE and your mouse has two buttons, the IlvEvent generated by the Rogue Wave Views library holds the IlvRightButton value. Otherwise, it contains the IlvMiddleButton value. The default value is FALSE.
For more information, see the member functions IlvDisplay::isRightButtonValueUsed and IlvDisplay::useRightButtonValue .
*[SolidColors]  If this resource is set to TRUE, the VGA system palette is used. The default value is FALSE if the number of colors available on the system is greater than 16; otherwise the default value is TRUE. This avoids dithered images on low-color graphical systems.
*[Warnings]  If this resource is set to TRUE, the warning messages are displayed. The default value is FALSE.
The member function getResource searches for resource definitions in several files, which are listed below in a decreasing order of priority:
1. EXECDIR\APP.INI
2. EXECDIR\PROG.INI
3. EXECDIR\VIEWS.INI
4. WINDIR\APP.INI
5. WINDIR\PROG.INI
6. WINDIR\VIEWS.INI
EXECDIR is the directory containing the executable program, and WINDIR is the directory where Microsoft Windows is installed. APP represents the name of the your application; this string is the one you provide to the IlvDisplay constructor. PROG is the base name of the executable file, its complete name being PROG.EXE.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.