IST  

X-Designer Frequently Asked Questions


This document contains answers to questions that our clients have raised. They fall into two categories, those that have been asked frequently and those which are potentially interesting and/or useful to other users.

Table of Contents

A. Licensing Procedures
B. Resource Management
C. X-Designer Start-up
D. X-Designer
E. XD/Help Integration
F. X/Motif
G. Windows Mode
H. VMS Specific
I. Generated Code
J. uil2xd
K. Other
L. Sample code

See also:

C++ generation white paper
X-Designer and MFC paper
Examples of code in $XDROOT/src/examples (see the README file)
Installation and Release Notes
User's Guide
A. Licensing Procedures
  1. What is "Error Code -8"?
  2. What is "Error Code -9"?
  3. What is "Error Code -10"?
  4. What is "Error Code -15"?
  5. What is "Error Code -16"?
  6. What is "Error Code -21"?
  7. What is "Error Code -57"?
  8. Can I run X-Designer on two different machines?
B. Resource Management
  1. Why my application does not pick-up its resources
  2. Why X-Designer does not pick-up resources set in my .Xdefaults file?
C. X-Designer Start-up
  1. X-Designer crashes upon start-up (core dump)!
  2. X-Designer crashes upon start-up (X Error)!
  3. Key Symbol errors are generated upon start-up
D. X-Designer
  1. How can I have X-Designer's dialogs to be independent?
  2. How do the resource mask toggles in the Generate dialog work?
  3. "Show Widget Name" shows widgets' variable names
  4. Cannot set resources on the instance of my definition
  5. There appears to be no help
  6. The X-Designer's dynamic display does not show my changes to the resources
  7. How do you revert a resource to its default value?
  8. The "Apply" button on the resource panel is greyed out
  9. Multiple instances of the same window structure
  10. How do you get variable names into Label strings?
  11. System modal appears to have no effect
  12. X-Designer overrides values given to resources
  13. How do you unmanage buttons inside a selection box or message box?
  14. How can I add dynamic behavior to my design?
  15. Why does X-Designer show fm_button, vm_button (etc) on its menubar?
  16. The "Add" button is greyed out in the Links dialog
  17. Hiding the primary window does not work outside of X-Designer
  18. Color selection panel does not show currently selected color
  19. None of the settings set up in XD are used in the generated application
  20. Reopening callback or prelude window shows old contents
  21. Can X-Designer import UIL?
  22. Upon entering translations, X-Designer complains about unknown actions
  23. How can I switch to full color icons?
  24. How do the "Links" and "Link functions" work?
  25. How can I add files to Makefiles generated by X-Designer?
  26. How do I remove the "diamond" from a radio box's toggle button?
  27. Why do I get an empty file when I generate code for a "children only" shell?
  28. Why does the Color Selection panel not contain any predefined color names?
E. XD/Help
  1. How Can I add HTML Help to my Application?
F. X/Motif
  1. How to traverse widgets using Tabs
  2. How to popup/pop-down dialogs
  3. How to set 8 bit character fonts in a Shell's title encoding
  4. How can "Close" from Window Manager call my close/exit callback?
  5. How to get to the resources of the sash in a Paned Window?
  6. Setting XFILESEARCHPATH does not seem to work
  7. How to make sure that a window is always visible
  8. How can you stop the Main Window being obscured by its children?
  9. How do you get a Label or Button to display a Pixmap?
  10. How do you set the initial width and height for a dialog?
  11. How can you set the position for a dialog shell?
  12. RowColumn does not resize when objects are added dynamically
  13. How do you get the "help" menu choice to stay on the right hand side of menubar?
  14. How do you get a Drawing Area inside a Scrolled Window to resize?
  15. Popup callback does not work on a primary window
  16. A Form with a List widget resizes every time the list changes
  17. How do I hardcode loose bindings?
  18. How to imitate the behavior of buttons in a Selection Box?
  19. How to leave XtAppMainLoop without exiting the application?
  20. Application crashes with "Cannot Allocate Color" Error
  21. Why my application's icon is not displayed correctly under olwm?
  22. How can I access the buttons of an option menu dynamically?
  23. How can I disable all the widgets in my dialog?
  24. How can I set the background color of a scrolled window?
  25. Problem with File Selection box on Solaris 2.5.1
  26. Missing rgb.txt file on Ubuntu Linux and other systems
G. Windows Mode
  1. Link errors using Visual C++ 2.2
  2. Cannot add "definition" button as a child of the pulldown menu
  3. Tips and hints for using MFC
H. VMS Specific
  1. Where is X-Designer's resource file and how can I modify it?
  2. How do I use my application's generated resource file?
  3. Where are the KeysymDB and the Keymap files kept on VMS?
  4. How do I run uil2xd?
I. Generated Code
  1. Global access to the X-Designer generated static objects (Font, Pixmap, Colour)
  2. C++ generation white paper
J. uil2xd
  1. Nothing seems to be happening!
K. Other
  1. How to put an SCCS id into X-Designer generated files.
L. Sample code
  1. Pop-up/pop-down dialogs
  2. Other


Go to top of this page


A. Licensing Procedures

1. What is "Error Code -8"?

Encryption code in license file is inconsistent

This error occurs when the information that we used to generate your authorization code does not match the information in the license file. Check that you have entered the correct release number, expiration date, number of users, etc.

2. What is "Error Code -9"?

Invalid Hostname

Generally, this error is generated when the hostname is not recognized by FLEXlm:

    1. Check that `hostname' returns the correct value
    2. Check that /etc/hosts contains the hostname (check the line defining `localhost')
3. What is "Error Code -10"?

Feature has expired

Generally, this error is generated either when the feature has really expired, in which case you should contact your supplier for a new license; or, you are using an older version of the "lmgrd" than that supplied with X-Designer.

4. What is "Error Code -15"?

Cannot connect to license server

Generally, this error is generated when X-Designer cannot connect to the license manager:

      1. Check that the license manager and the product daemon are running:

    • Run $XDROOT/lmgr/bin/lmstat to give you information on the license daemons.
      1. Check the license manager's log file for any relevant information. This is usually in /tmp/license.log, check the command used to start the license manager for the exact location of the file.
      2. Make sure that the license file that is picked up by the license manager is the correct one. The log file generated by the license manager would say which license file it is using.
      3. Make sure that you are not running an older version of the license manager.

    • Check the license log file for the version of the license manager daemon.

    • Check the path to the product daemon in the license file. Make sure it is pointing to the correct binary.
5. What is "Error Code -16"?

Cannot read data from license server

This error can occur when the license manager has an earlier version than the daemon. Make sure that you run the latest release of the license manager software or at least that was distributed with X-Designer.

This can also occur when trying to run X-Designer on Solaris with ulimit set too high.

When trying to start lmgrd the error message:
(IST) Vendor daemon can't talk to lmgrd (Cannot read data from license server (-16,15:22) Invalid argument)
and when trying to start X-Designer the error message:
License not validated: Cannot read data from license server (-16,15:22) Invalid argument
are both solved by setting ulimit to 1024 as follows. Note that in some cases the error numbers may be missing.
Start lmgrd with a script like:
#!/bin/sh
# /bin/sh must be used because the behaviour of ulimit varies with the type of shell.
ulimit -n 1024
ulimit -H -n 1024
nohup /opt/xdesigner/lmgr/lib/lmgrd -c /opt/xdesigner/lib/license.dat > /tmp/lmgr.log 2>&1 &
Start X-Designer with a script like:
#!/bin/sh
ulimit -n 1024
ulimit -H -n 1024
/opt/xdesigner/bin/xdesigner
Alternatively edit the shell script /opt/xdesigner/bin/xdesigner to add the ulimit commands to it near the beginning (or at least before it calls /opt/xdesigner/lib/xdesigner).
Notes:
X-Designer 7.1.x and later have the X-Designer startup script so modified.
X-Designer 9.0 and later have had lmgrd modified to be a shell script which sets ulimit and then calls the lmgrd program.
6. What is "Error Code -21"?

License file does not support this version

Generally, this error is generated when you have just upgraded to a new release. The license manager is still picking the old version of the license file. Make sure that the license manager is restarted with the new version of the license file. You can also use the environment variable LM_LICENSE_FILE to force a specific file to be picked as the license file.

7. What is "Error Code -57"?

Socket protocol not supported

Generally, this error is generated when you try to run the license manager but the transport protocol (e.g. TCP/IP) is not running.

8. Can I run X-Designer on two different machines?

It is the license manager that is locked to a particular machine, defined by its (lm)hostid, not X-Designer.

FLEXlm is a Floating License manager. Any machine on the same network as the machine running the license manager (lmgrd) can access/request a license. The machines do not have to be the same type.

Once you have your license manager running, to get another machine to have the ability to run X-Designer, you need to ensure the following:

      1. A copy of X-Designer appropriate for the machine is accessible by the machine.
      2. The various links put in by the installation process are also in on this machine - you can do this by running the install script on this machine if necessary.
      3. The license file (or an exact copy of it) is accessible on this machine (either in /usr/local/flexlm/licenses/license.dat or pointed to by LM_LICENSE_FILE. You could also set LM_LICENSE_FILE to 1700@fred where fred is the hostname of the machi ne running the license manager, and 1700 is a port number used by the license manager as specified in the SERVER line of the license file.


Go to top of this page


B. Resource Management

1. Why my application does not pick-up its resources

Using X-Designer, I have generated the source code and a resource file. Once I built my application and ran it, it did not pick- up the values from the resource file.

The X toolkit searches for the resource file in a number of places, based on a template string. Here is a simple description of what to look for:

      1. Make sure that the Application Class (entered in the Generate dialog of X-Designer) is the same as the name of the resource file.
      2. Make sure that the resources in the resource file use the correct application Class.
      3. Set the environment variable XENVIRONMENT to point to the resource file and then run the application. If it still does not pick-up the resources, then the problem is not with the toolkit not finding the correct file but with the application expecti ng a different class name.
      4. If setting XENVIRONMENT makes your application run with the correct resources, then the problem is not with the application but with the environment (i.e. location of the file and search templates setup)
      5. There are several ways to set up search templates such as XUSERFILESEARCHPATH, XFILESEARCHPATH, XAPPLRESDIR... For example if your application class/name is apptest and XFILESEARCHPATH is set to /u/calvin/%T/%N%S and the resource file is in /u/calvin/app-defaults/apptest, the resources will be picked up when the application is run.

For more details check the Xt Programming Manual (O'Reilly) and/or Advanced Motif Programming Techniques (Prentice Hall)

2. Why X-Designer does not pick-up resources set in my .Xdefaults file?

I am using openlook window manager. When I set the resource XDesigner.definitionsFileName it is not picked up by X-Designer.

If the server has the RESOURCE_MANAGER property set on the root window of the display, it will not read the user's .Xdefaults file. You typically set the RESOURCE_MANAGER property using xrdb.

OpenWindows start-up script will xrdb your .Xdefaults file. This has the effect that the resources set in the .Xdefaults file after OpenWindows is started will not take effect until you re-run xrdb.


Go to top of this page


C. X-Designer Start-up

1. X-Designer crashes upon start-up (core dump)!

As soon as I start X-Designer, it dumps core.

This may be because XNLSPATH is not set up correctly. Set it to point to the nls directory provided as part of the X-Designer release. This is true only on versions that are statically linked with the X libraries.

2. X-Designer crashes upon start-up (X Error)!

When I start X-Designer, it crashes with an X Error such as: X Error of failed request: BadLength (poly request too large or internal Xlib).

This may be because your server cannot handle the color pixmaps used by X-Designer. To use the monochrome default pixmaps, set XD_ICONS to default.

3. Key Symbol errors are generated upon start- up

When I start X-Designer, I get an error dialog saying that `em_cut' accelerator key is not supported.

X-Designer has based its accelerator on OSF key standards. Unfortunately, these keys are not available on all keyboards. If your keyboard does not have a key used by X-Designer, you will get the warning message. These accelerators are defined in X- Designer's resource file located in $XDROOT/app-defaults. You can comment out the lines that define accelerators using the keys that your keyboard does not have, to avoid getting the warning messages.


Go to top of this page


D. X-Designer

1. How can I have X-Designer's dialogs to be independent?

I want to be able to move X-Designer's different windows independent of each other. I want to be able to place the main window in front of the dynamic display.

To make the X-Designer's dynamic display independent, you should set the following resources:

      • XDesigner.dialogsTopLevel: true
      • XDesigner*transient: false

See X-Designer User's Guide for more information on these resources.

To make all of X-Designer's windows independent of each other (including the resource dialogs, etc.), you should set the following resource:

      • XDesigner*XmDialogShell.transient: false

Note that once the dialogs become independent, you may have difficulty reaching them if you have many windows on top of each other.

Also note that this is only a feature of Motif Window Manager and is not an issue in other window managers.

2. How do the resource mask toggles in the Generate dialog work?

The Generate dialog has two resource mask toggles? How are they used?

  • "Mask Widget Resources" means that the decision to generate resources into a file is based on the type toggles (in the generate dialog) and the individual resource toggles (in widgets' resource dialogs) FOR ALL RESOURCES.
  • "Mask Only Global Resources" means that the decision to generate resources into a file is based on the type toggles (in the generate dialog) and the individual resource toggles (in widgets' resource dialogs) ONLY FOR OBJECTS. This decision is based o nly on the individual resource toggles (in widgets' resource dialogs) FOR ALL OTHER RESOURCES.
3. "Show Widget Name" shows widgets' variable names

When I select "Show widget name" from the "View" menu option, the widgets' variable names are displayed in the Construction Area.

This is done on purpose because most users want to see the variable name and associate that with the widget's name.

4. Cannot set resources on the instance of my definition

When I bring up the resource panel for a widget in the instance of my definition, the "Apply" button is insensitive.

This occurs when your definition (and therefore its instance) is a C++ class. By default, X-Designer sets a "protected" access for the class and its children. This means that only functions within the class or within classes inherited from this cla ss may modify these data members. To modify the resources of an instance you need to give "public" access to the widget of the instance you wish to modify.

5. There appears to be no help

On invoking help, the Help dialog texts are blank.

There is a resource, XDesigner.helpDir, for the location of the help database. If the file XDesigner.cdb is not where indicated, the help dialogs will be empty.

6. The X-Designer's dynamic display does not show my changes to the resources.

I change a resource value and hit "Apply" but I do not see the change on the dynamic display.

Some resources can only be set at creation time. Therefore, you must "Reset" the widget to force it to be recreated, before you can see your changes.

Note that some create time resources will never be seen in the dynamic display. 7. How do you revert a resource to its default value?

Having changed the value of a resource, how do you tell the resource to take the default again?

You simply delete the value, and press "Apply". If you want to see what default value Motif would use, select the "Reset" button from the Widget pull down menu (or ^T). The value inside the parenthesis will then reflect the Motif default if there is one.

8. The "Apply" button on the resource panel is greyed out.

I cannot set the resources since the "Apply" button is greyed out.

There may be two reasons for the "Apply" button to be greyed out:

  • The resource panel is not that of the widget selected in the Construction Area.
  • The selected widget is an instance of a definition which has protected access, see point D.4 .
9. Multiple instances of the same window structure.

How do you get multiple instances of the same window structure without predefining several identical windows in X-Designer?

You need not define identical structures in X-Designer.

  • From within X-Designer, you can turn a widget hierarchy into a definition to be used later in other designs.
  • Dynamically from the generated application, simply call the generated create routines as necessary to create extra instances of the window structure. If you need to access an earlier instance again, save its widget id in a variable.

You can also generate code for parts of your dialog only by using "Children Only" in the Code Generation page of the Core resources dialog.

10. How do you get variable names into Label strings?

How do you get variable names into Label strings and message strings? I want a global variable to inhabit these places, not constant strings.

The simplest way to get variable names into Label strings is to put the following in the pre-create code prelude for the appropriate widget:

     XtSetArg (al[ac], XmNlabelString, variable); ac++;

and leave the label string as default in the resource panel for the widget. The variable should be declared as type XmString, and can be declared or extern'd in the module prelude. You will then need to use

    variable = XmStringCreateLtoR ("string",
       (XmStringCharSet) XmString_DEFAULT_CHARSET);

The same means can be used for message strings, and any other values that need to be set under program control, rather than setup statically.

11. System modal appears to have no effect.

Setting the dialog Style resource of Bulletin Board to System Modal or Full/Primary Application Modal appears to have no effect on the design window.

This is only the case in X-Designer and not in the generated code. This we did at the request of users who found that they were forever having to pop-down the offending dialog before doing anything else in X-Designer (or other clients in the case o f system modal).

12. X-Designer overrides values given to resources.

For example, specifying the width of a text widget in a Row Column from the Core resource panel is ignored as soon as it is applied.

This is Motif, not X-Designer. The philosophy behind X-Designer shows the interface that Motif will give you, so it will reflect the final behavior of the designed application. The effect the user sees is the actual behavior of Motif, X-Designer ne ver re-specifies a value.

In the example of a RowColumn widget, the defined behavior of a RowColumn is that all of its children are resized so that they have the same width and height. When you make the width smaller, the RowColumn widget simply makes it bigger again to match the other text widgets. The toolkit will sometimes interpret the setting of a particular widget resource by adjusting several other resources.

13. How do you unmanage buttons inside a selection box or message box?

In a Message Box, for example, how do you configure it to get just one or two buttons rather than the default three?

You can toggle off the Manage toggle in the Code Generation page of the Core resource panel for each of the buttons.

14. How can I add dynamic behavior to my design?

How can I popup/pop-down a window with a click of a button, or, how can I enable/disable a widget with a click of a button?

X-Designer provides the "Edit Links" facility to allow you to prototype dynamic behavior. The mechanism allows window navigation: e.g. popup window2 if button1 is pressed. It does not take into account the state of the interface. So it is not possible to say popup window2 if window3 is not currently displayed. To provide this level of prototyping, the user must link in some code, where the callbacks provide the desired behavior. One way of doing this is to generate the links callbacks once in the stubs file and then modify the functions to suit your application.

15. Why does X-Designer show fm_button, vm_button (etc.) on its menubar?

X-Designer comes up with a single column of widgets in the widget palette, everything has a blue cast, and widgets have labels such as vm_button, wm_button.

X-Designer is not picking up its application defaults file. This is usually because it has not been installed correctly. Check to make sure that the file "XDesigner" exists in the app-defaults directory under the X-Designer root directory. Also che ck to make sure that the file is not corrupted.

16. The "Add" button is greyed out in the Links dialog.

When linking a button to a widget, the add button in the Links dialog is greyed out when the widget is selected.

You have to make sure that both the button and the widget that you are trying to link to are named. If a button is linked to a shell rather than any other widget (any part of the user interface can be hidden etc.), then both the Shell and its child need to be explicitly named. This is because in Motif, it is actually the child of the shell which needs to be unmanaged. We let you link to the shell itself because this is the more natural way to describe what you want.

17. Hiding the primary window does not work outside of X-Designer.

When prototyping a design in X-Designer, it is possible to use the Links mechanism to hide a Primary window. When running the generated application, however, the primary window does not disappear, though its contents do.

The prototyping of a user interface in X-Designer is as close to the actual behavior as we can get. A primary shell, however, is actually a secondary shell in X-Designer and may sometimes behave differently as described here.

In an application, it is usual to have the primary window mapped at all times. This provides an anchor for the user, so that he can always get at the top level functions of the application, such as Exit. If it is required to pop-down the primary window in the same way as the dialog windows, this can be done by unmapping the application shell, from within the code. It is more likely that the user interface should be re-designed so that the primary window is not hidden.

18. Color selection panel does not show currently selected color.

In the color selection panel, the bar at the top does not change color when a new color is selected, or the color is changed using the sliders.

This is because the colormap for the local server has been completely allocated. A typical UNIX workstation monitor has a colormap with 256 entries, which should be more than ample for several applications to run on that server and use its own colo rs. Circumstances that can give rise to this are:

  • Your design uses a very large number of color objects (e.g. over 100). Chances are that the design does not need the large number of user-defined color objects. Motif usually provides sensible defaults for most purposes, such as shading. If the app lication does require a large number of colors, you might consider installing your own colormap when starting up the application. Note, however, this can be very user-unfriendly as X will switch colormaps when in your application, and all other applicatio ns running on the same server at the same time.
19. None of the settings set up in XD are used in the generated application.

Having set up resources, such as changing a Text widget to behave as Multi-line text, the prototype behavior is as expected in X-Designer, but not in the generated application.

There may be several reasons:

  • The wrong masks are being used in the Generate panel.
  • The wrong (or no) defaults file is being picked up.

20. Reopening callback or prelude window shows old contents.

When reopening a callback window or code prelude window, it shows the previous contents of the window.

This is because the "Retain" toggle has been switched on. This toggle is designed to give exactly this behavior, allowing you to reuse text typed in a previous window.

21. Can X-Designer import UIL?

X-Designer can generate UIL but can it read UIL?

Yes. There is a separate filter called uil2xd which converts uil files into X-Designer saved file.

22. Upon entering translations, X-Designer complains about unknown actions.

Having entered a translation for a menu button, and used the Apply button in the Translations dialog, X-Designer puts up an Error dialog saying "Actions not found".

If the action being specified is a standard Motif action, check the spelling. If, however, it is an action that you will provide as part of your application, then treat the message as just a warning. You will have to provide that action in your app lication.

23. How can I switch to full color icons?

When I bring up X-Designer, the widget icons are simple bitmaps. How can I change them to the full color icons?

By default, X-Designer uses a set of icons that use a minimal set of colors. Set the environment variable XD_ICONS to "color_icons", to change to full color icons. Note that if you need to reduce the color usage of X-Designer, you should use the bi tmap icons. To go back to bitmap icons, set XD_ICONS to "bitmaps" or simply unset XD_ICONS. If you would like to use the monochrome icons, set XD_ICONS to "default".

24. How do the "Links" and "Link functions" work?

Why would I want to set one toggle and not the other?

If you want to have anything to do with links in the generated file, then you must have the "Links" toggle set. If this toggle is not set, then setting or unsetting the "Link functions" will not have any effect. Once you have set the "Links" togg le, then if you want the complete functions to be generated in your file, you then set the "Link functions" toggle. If "Link functions" is unset, then only function declarations (externs) are generated in the file.

25. How can I add files to Makefiles generated by X-Designer?

How can I add existing files to be built by the Makefile generated by X-Designer?

X-Designer uses templates for its Makefile generation. You probably don't want to modify the template itself, since that would force every Makefile that is generated by X-Designer to contain your new modifications.

To modify the Makefile for one design and be able to regenerate that Makefile, you must do the following:

      1. Generate a Makefile with the "New" toggle on.
      2. Modify the generated makefile to add all the files needed.
      3. Next time you generate the makefile from X-Designer, make sure that the "New" toggle is not set.

If you are using multiple design files and therefore are generating a makefile template, then you can also do the following:

      1. Generate a Makefile with both the "New" and the "Makefile Template" Toggle on. You should do this only once. All the other times that you generate the Makefile, the "New" toggle should be clear and the "Makefile Template" toggle should be set.
      2. Modify the Makefile to add the following:
        #X-Designer:USER_CC_OBJECTS=foo.o foo2.o
        (where foo and foo2 are your files.)
      3. In the Makefile, add "$(USER_CC_OBJECTS)" to the end of:
        #X-Designer:XDG_CC_PROGRAM: XDG_CC_PROGRAM_OBJECT $(XD_CC_OBJECTS) $(XD_CC_STUB_OBJECTS)
      4. Regenerate the Makefile this time with the "New" toggle off.
26. How do I remove the "diamond" from a radio box's toggle button?

Using X-Designer, how can I remove the diamond from toggle buttons in a radio box?

You must do the following:

      1. In the Settings page of the toggle button's resource dialog, set "Indicator" to "No".
      2. In the Margins page of the toggle button's resource dialog, set "Left" to 0.
      3. In the Dimensions page of the toggle button's core resources dialog, set the "Border shadow" to a positive value.
27. Why do I get an empty file when I generate code for a "children only" shell?

I have a shell which is set to be "Children only". When I generate C code, the generated file is empty. Why?

If you specify a widget as "Children only", code is generated only for children which are (a) structured or (b) named. Therefore, if all you have underneath that widget are unnamed and unstructured widgets, then all you get in the generated file a re declarations, hence the file appears to be empty.

28. Why does the Color Selection panel not contain any predefined color names?

The X Colors listbox in the Color Selection panel/window is supposed to contain predefined color names but it is empty. Is there some reason why the predefined colors are missing? Is there anything I can do to get them back? The same thing is true with the Pixmap editor.

The problem is due to XDesigner not being able to find the X11 "rgb.txt" file. It is supposed to be found in XFILESEARCHPATH. Unfortunately some distributions of X Windows have locations of this file that are not included in XFILESEARCHPATH. The default location is /usr/lib/X11/rgb.txt, but that file may not be present on your system. The fix is to create a symbolic link of /usr/lib/X11/rgb.txt that points to the real rgb.txt file or ensure that XFILESEARCHPATH contains a path with it in.

If you are running under Solaris, you may find the rgb.txt file location is /usr/X11/lib/X11/rgb.txt. If you are running under Linux, you may find it at /usr/share/X11/rgb.txt or /etc/X11/rgb.txt.


Go to top of this page


E. XD/Help

1. How can I add HTML Help to my Application?

How can I use XD/Help with my application?

In the Module menu in X-Designer Select Help Defaults...

Configure the necessary paths to your HTML documents and the document you would like to open by default when starting help
Also select the default viewer from the option menu. (These instructions are based on you using XD/Help).

Select the widget to which you would like to attach the help and go to its core resources panel Widget -> Core Resources. In the dialog displayed, go to the code generation options page.

At the bottom of the code generation page there are two frame divided sections. The first is labelled 'Help callback' and the second 'Activate callback':

Help Callback - the page invoked if the user selects the standard help key on the system, this could be 'F1' or a dedicated HELP key.
Activate Callback - The HTML page opened when the widget is selected.
Once you have configured which help should be attached to which sections of the program you are ready to generate.

Once you have generated the code, you will need to link in some additional code provided which contains the help manipulation functions. This code is freely distributable. There are two things needed for the code, these are the client side library of XD/Help and the link functions necessary to interface with the library. The files that need to be included are (Where $XDROOT is the top level directory of the X-Designer distribution)

$XDROOT/src/help/client/lib.a
$XDROOT/src/libhelplink/helplink/helplink.o
These files need to be built from the sources, a simple "make" in the directory should do this automatically.

To include them correctly in the makefile, add the helplink.o file into the link line where the object files for the main application are defined. For example if your application were called test, you would do the following.

test: test.o $(XD_C_OBJECTS) $(XD_C_STUB_OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test helplink.o test.o
$(XD_C_OBJECTS) $(XD_C_STUB_OBJECTS) $(XPMLIB) $(MOTIFLIB)
$(XSYSLIBS)

The last stage, is to include the client library of XD/Help so the viewer can start.

In the program configuration section of the makefile, add the following line:

HELPLIB = ${XDROOT}/src/help/client/lib.a
You then need to modify the link line again to include the client library $(HELPLIB).
test: test.o $(XD_C_OBJECTS) $(XD_C_STUB_OBJECT) $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test helplink.o test.o $(XD_C_OBJECTS) $(XD_C_STUB_OBJECTS) $(HELPLIB) $(XPMLIB) $(MOTIFLIB) $(XSYSLIBS)
Build and Run your application.


Go to top of this page


F. X/Motif

Note: Some of the information in this section is extracted from Advanced Motif Programming Techniques by Alistair George and Mark Riches. It is published by Prentice Hall.

1. How to traverse widgets using Tabs

How can I move between widgets using the tab key?

Tab group traversal is based on the "Navigation type" resource (core resources, Settings page).

If a widget hierarchy contains only widgets with the resource "Navigation type" set to NONE, TAB_GROUP or STICKY_TAB_GROUP, the tab key moves the focus in a left to right and top to bottom order. That is, the order of traversal is determined by the location of the widget on the screen.

If a widget hierarchy contains any widget that has "Navigation type" set to EXCLUSIVE_TAB_GROUP, only widgets with EXCLUSIVE_TAB_GROUP or STICKY_TAB_GROUP will be traversed, in the order in which the tab groups were created.

Note that to traverse through widgets within a tab group, the arrow keys (and not the tab key) is used. 2. How to popup/pop-down dialogs (See the sample code at the end of the document)

How do I bring up a dialog (not using the "Links" functionality in XDesigner)?

There are different ways of opening and closing down dialogs depending on the type of the Shell widget:

  • To pop-up dialogs
      • Top Level Shell: The shell must be realized first using XtRealizeWidget and then brought up using: XtPopup. You can check to see if a widget is already realized using XtIsRealized.
      • Application Shell: If the shell is not realized then XtRealizeWidget will realize and bring up the dialog. If the shell is already realized, then you must use XtMapWidget to bring up the dialog.
      • Dialog Shell: A call to XtManageChild should bring up the dialog
  • To pop-down dialogs:
      • Top Level Shell: If the widget is realized then you must use XtPopdown to bring down the dialog.
      • Application Shell: If the widget is realized, then you must use XWithdrawWindow to bring down the dialog.
      • Dialog Shell: You must use XtUnmanageChild to bring down the dialog.
3. How to set 8 bit character fonts in a Shell's title encoding

X-Designer crashes when setting the title of a shell using swedish characters!

This is due to a bug in X/Motif. The work-around is to set the "titleEncoding" resource to STRING. This can be done by setting the resource in your .Xdefaults file: XDesigner*dialog.titleEncoding :STRING or *titleEncoding:S TRING

To hard code it into your design, you must enter:

XtSetArg (al[ac], XmNtitleEncoding, XA_STRING); ac++;

4. How can "Close" from Window Manager call my close/exit callback?

How can I associate the Window Manager's Close button with my callback?

This is done by handling the WM_DELETE_WINDOW message that the window manager sends to an application's top-level window.

  • You have to first disable the default behavior by setting the "deleteResponse" resource (Settings page of Shell's resources) to "Do nothing".
  • You must add a protocol callback whose type is ClientMessage, message_type is WM_PROTOCOLS and data.1[0] is WM_DELETE_WINDOW. For example:
    Atom my_delete_window ... my_delete_window = XmInternAtom(XtDisplay(app-shell), "WM_DELETE_WINDOW", False); XmAddWMProtocolCallback (app_shell,my_delete_window, my_delete_callback, (XtPointer) NULL); ...
5. How to get to the resources of the sash in a Paned Window?

How can I set the color of the sash in a Paned Window widget?

The sash in a Paned Window is actually a separate widget called "sash". To set its color in the resource file you can enter:

XApplication*XmPanedWindow*sash.foreground: red

... or

XApplication*XmPanedWindow*XmSash.foreground: red

6. Setting XFILESEARCHPATH does not seem to work.

How does XFILESEARCHPATH work?

Setting of XFILESEARCHPATH is done through templates that ultimately map to a single file. For example if you have an application called MyXapp (MyXapp is the application class name) and you would like the application to automatically pick up its r esource file which resides in /usr/john/app-defaults, you can define XFILESEARCHPATH to be:

/usr/john/%T/%N%S

%T is the type and is replaced by "app-defaults"

%N is replaced by the application class

%S is the suffix and is replaced by NULL.

For more information also see section B. Resource Management

7. How to make sure that a window is always visible.

How can I keep a window always on top of all the other windows?

You must trap the events that are generated when the window is covered and place the window back on top:

  • Add an event handler to trap all VisibilityChange events and call your callback:
    XtAddEventHandler(sh1, VisibilityChangeMask, False, keep_on_top, NULL);
  • Add the callback to keep the window on top of the other windows:
    void keep_on_top (w, client_data, event) 
	Widget w; 
	XtPointer client_data; 
	XEvent * event; 
	{ 
	    if ((event->xvisibility.state == VisibilityFullyObscured) ||
		    (event->xvisibility.state == VisibilityPartiallyObscured)) 
	    { 
		XRaiseWindow(XtDisplay(w), XtWindow(w)); 
	   }
	}
8. How can you stop the Main Window being obscured by its children?

When running an application under the Motif Window Manager, it is impossible to bring the Main Window to the top.

This is a feature of the Motif Window Manager. If you want to have the ability to bring something from the Main Window to the top of the window stack, you can consider putting it in a secondary window, rather than the main window. i.e. keep the primary window of your application small. Also see point D.1 regarding the transient resource.

Note, this is not a problem under twm or other window managers. 9. How do you get a Label or Button to display a Pixmap?

Having set the pixmap resource to the bitmap required and `Applied' it, the label does not show the pixmap.

You must also set the "Type" resource to "Pixmap". This can be found on the Settings page of the Button/Label's resource panel.

10. How do you set the initial width and height for a dialog?

Setting the width and height resources in the Core resource panel for a dialog shell has no effect. They get overridden when they are applied.

In Motif, it is the child of the Shell, not the Shell itself, for which the initial width and height can be set. Even at that, these values are taken as `hints' by the Window Manager and are not necessarily used.

Note that the minimum height and width can be set for a Shell directly. 11. How can you set the position for a dialog shell?

Setting the X and Y coordinates in the Core resources for a Shell has no effect on the position of the Shell.

The child of the Shell is usually a Bulletin Board, or a widget derived from Bulletin Board (e.g. Form). The Bulletin Board has a resource "Default position" (see Settings page), which Motif sets to "yes" by default. This should be set to "no" to s top Motif centring the shell in its parent.

12. RowColumn does not resize when objects are added dynamically.

The hierarchy has the Row Column in a Scrolled Window. Adding labels to the Row Column is no problem in X-Designer, it resizes to include the new child. If, however, the labels are added dynamically from the application code, the Row Column s tays a fixed size.

After each new child is added to the Row Column, do a call to XmScrolledWindowSetAreas to re-layout its children.

13. How do you get the "help" menu choice to stay on the right hand side of menubar?

X-Designer's "Help" button stays on the right hand side, no matter how large the window has been stretched. Which resource is set to make this happen?

"Help widget" resource on the Display page of the Menubar's resource panel should be set to the name of the cascade button that is to be used for help.

14. How do you get a Drawing Area inside a Scrolled Window to resize?

With a Drawing Area as a child of a Scrolled Area, how do you make the Drawing Area resize with the Scrolled Window so that it is always the same size as the Scrolled Window?

If resize behavior is required, you should use the Form widget. The Form widget and the Scrolled Window widget offer different behavior onto their children. The scrolled window provides a fixed sized viewing area onto its children, and offers scrol l bars to allow you to scan over them. The form widget allows you to define the view you get by resizing the window.

What is probably required is something between the two. To do that, put the Scrolled Window as a child of the Form, and the Drawing Area as a child of the Scrolled Window. Make the Drawing Area large (so that there is still something to scroll when you resize the window).

The "Resize policy" resource of the Drawing Area controls how geometry requests of children are handled. The Drawing Area may refuse all requests that would change its size, it may only grow or it may adapt to whatever size its children want. This reso urce is only appropriate of course, if the Drawing Area has children.

15. Popup callback does not work on a primary window.

The resource panel for Shell allows a callback type Popup to be defined. If the Shell is a primary shell, this callback is never called.

Indeed, the Popup callback is only appropriate for secondary Shells. In Motif terms, the Popup callback is used by Dialog Shells and Menu Shells. The Popup callback is not available for the primary window. To do an action that might require a Popu p callback, you can call that action directly before doing the XtRealize on the primary window.

16. A Form with a List widget resizes every time the list changes.

In the generated application, a window containing a Form which has a List widget in it changes size when the user takes an action to change the contents of the list. How can you restrict the behavior to only resize the window if the user specificall y resizes the window from the Window Manger.

The default behavior of the Form widget is to accept geometry requests from its children. However, this is often not the required behavior. To stop the Form resizing when you don't want it, set the "Resize" resource in the Settings page of the reso urce panel to "None".

17. How do I hardcode loose bindings?

I want to set the background color of all my widgets to grey. I can do this from the resource file by using "*background: grey". How can I hard code this into my generated application.

You can add resources to the resource database by adding the following code in the premanage or precreate prelude for the application shell:

XrmPutStringResource (XtDatabase(display), "*background", "grey");

Remember to include <X11/Xresource.h> 18. How to imitate the behavior of buttons in a Selection Box?

Using a Form, how can I place buttons at the bottom of the form so that they behave in the same way as button in a Dialog Template or a Selection Box, when the form resizes.

There is a Motif restriction that does not allow you to do this. Certain widgets have this behavior built in but users cannot achieve this by using a Form or a Row Column. You could use a Dialog Template and unmanage the Separator to get the desired effect.

19. How to leave XtAppMainLoop without exiting the application?

The GUI application is invoked from inside a larger application. Once the GUI application is finished, how can I continue running the other part of my application.

Instead of using the XtAppMainLoop, create your own main loop by copying the few lines that are in the Xt function. Then, add some form of While loop that your application can exit from, when it needs to.

20. Application crashes with "Cannot Allocate Color" Error.

My X-Designer generated application crashes with "Cannot allocate colormap entry ...".

Either your application is using too many colors or some of the other applications you are running alongside your XD generated application use too many colors (FrameMaker and Netscape are known for the number of colors they use).

Your options are either to reduce the number of colors and/or program defensively to catch these XErrors. You should add your own event handler to your program to explicitly check for the Xt error color full message. See the Xt reference manual (Vol5 in O'Reilly series), p444/445 on XtErrorMsgHandler.

21. Why my application's icon is not displayed correctly under olwm?

When I iconize my application under OLWM, it does not display the pixmap I defined in X-Designer, it uses the default icon.

Icon Pixmaps must be bitmaps. So if you want to use the XmNiconPixmap resource, you must provide a pixmap with depth of one. Apparently, Motif can handle it if the depth is greater than 1 but not all window managers (e.g. olwm) can.

  Pixmap    new_pixmap;
  new_pixmap = XmGetPixmapByDepth(XtScreen(shell), "/usr/include/X11/bitmaps/star", 1, 0, 1);
  XtVaSetValues(shell, XmNiconPixmap, new_pixmap, NULL);

If you want to have colors, then you must create an icon_window rather than an icon_pixmap, and set the resource XmNiconWindow to this newly created window.

  Window    new_win, root_win;
  Pixmap    pixmap;

  Unsigned int      height, width  ....
  XGetGeometry (XtDisplay(shell), pixmap, &root_win, &x, &y,&width,
      &height, &border_width, &depth);
  new_win = XCreateSimpleWindow(XtDisplay(shell),
      pixmap, &root_win, 0, 0, width, height, 0, 0, 0);
  XSetWindowBackgroundPixmap (XtDisplay(shell), new_win, pixmap);
  XtVaSetValues (shell, XmNiconWindow, new_win, NULL);
22. How can I access the buttons of an option menu dynamically?

How can I access the buttons of an option menu, without knowing their names or their number?

The buttons are the children of the pulldown menu pane. Therefore, you first have to get the widget id of the pulldown menu using the XmNsubMenuId resource and then you can get the list of the children using XmNChildren and XmNnumChildren resource s.

23. How can I disable all the widgets in my dialog?

How can I disable all the widgets in my dialog without knowing how many widgets I have?

You can use the function XtSetSensitive with your shell widget to render the shell and all of its children insensitive.

24. How can I set the background color of a scrolled window?

I have a scrolled window with its background color set to a specific color. When I resize my window (make it larger), there is still an area that does not have the background color I specified.

A scrolled window creates another window called the "clip window". You need to set the background color of this window as well. You cannot do this in X-Designer. The following can be added in code preludes to set the background color of the clip window:

     Widget  clipwin;
...
    ac = 0;
    XtSetArg(al[ac], XmNclipWindow, &clipwin); ac++; XtGetValues(sw, al, ac );

(sw is the scrolled window widget)

    ac = 0;
    XtSetArg(al[ac], XmNbackground, "blue"); ac++; XtSetValues (clipwin, al, ac);
25. Problem with File Selection box in Solaris 2.5.1

When bringing up the file selection box on Solaris 2.5.1 box, the file name list is not justified. The file name list starts with the root path and there is no way (no slidebar) to allow you to see the files in the directory.

This is a problem with the Motif in Solaris 2.5.1. You need to apply patch 103461-01 (available from Sun Microsystems) to fix this problem.

26. Missing rgb.txt file on Ubuntu Linux and other systems

When trying to run xdcapture, xdreplay or xdrecord a long error trace is produced ending with:
"Cannot find rgb.txt". It needs to be in /usr/lib/X11.

The solution on Ubuntu Linux is to copy or link rgb.txt from /etc/X11 to /usr/lib/X11 or just link it: ln -s /etc/X11/rgb.txt /usr/lib/X11/rgb.txt. The solution on other Linux or Unix systems is the same except that rgb.txt may be in a different location.


Go to top of this page


G. Windows Mode

1. Link errors using Visual C++ 2.2

After building a simple design on X-Designer and moving the files to Visual C++ 2.2, they compile correctly but the linker complains with messages such as "error LNK2001: unresolved external symbol "__beginthreadex""

The default setting in Visual C++ 2.2 is not to include MFC libraries. To fix this, go to the "Project settings" and in the "General" page, check the value for "Microsoft Foundation Classes". It defaults to "Not in MFC", it should be set to "Use MFC in a shared DLL".

2. Cannot add "definition" button as a child of the pulldown menu

I have a button that is a defintion. In my design, I have a pull down menu where I would like to insert an instance of this definition, but the icon is greyed out and I cannot select it.

In order to be Windows compliant, children of a pulldown menu cannot be structured (a pulldown menu in Windows is a single object not multiple objects as in Motif). This is why the definition is greyed out.

3. Tips and hints for using MFC

A separate document containing various tips and hints when using X-Designer to generate MFC code.


Go to top of this page


H. VMS Specific

1. Where is X-Designer's resource file and how can I modify it?

I want to customize X-Designer, how do I do that?

Upon installation, X-Designer's resource file, "XDesigner.dat" is moved to SYS$ROOT:[DECW$DEFAULTS.USER]. This is the directory where all the non DEC applications' resource files are kept.

There is a logical called DECW$USER_DEFAULTS that points to the directory/directories where a user's customized resource files are kept. By default, this logical points to SYS$LOGIN (your home directory). You can reassign this logical to point to an y directory or list of directories that you want. For example:

   $ Assign SYS$LOGIN, DK300:[User1.dir1], DK300:[User2.dir2]DECW$USER_DEFAULTS

When an application is executed, it first looks into the directories pointed to by DECW$USER_DEFAULTS for its resource file and if it did not find the file, it will then look into directories pointed to by DECW$SYSTEM_DEFAULTS.

To customize X-Designer's resource file, copy it into your home directory (the directory pointed to by DECW$USER_DEFAULTS), and modify it to suit your requirements.

2. How do I use my application's generated resource file?

Using X-Designer, I have generated a resource file for my application. How can I force my application to pick it up?

There are several points that you have to follow when generating the resource file for your application:

  • The name of your resource file has to be the same as the name of your executable plus the ".DAT" extension. (i.e. X-Designer's resource file is XDesigner.DAT)
  • The generated resource file must be in a directory pointed to by either DECW$USER_DEFAULTS or DECW$SYSTEM_DEFAULTS. The latter points to the directories used for installed applications resources (This is where your customer should pick up your application's resource file from):
    • SYS$ROOT:[DECW$DEFAULTS.USER] => generally used for non DEC application resources.
    • SYS$ROOT:[DECW$DEFAULTS.SYSTEM] => generally used for DEC windows/application resources.

Once the resource file is named correctly and is in the correct location, then you can simply run your application and it will automatically pick up the appropriate resource file.

Note that if you have two different application with the same executable name, then you can make sure that they each pickup their appropriate resources by using different "application class name" when generating the resource file. There is still one r esource file but inside there are resources for both applications, distinguishible by the "application class name".

3. Where are the KeysymDB and the Keymap files kept on VMS?

Where is the KeysymDB? Where are the Keymap files?

KeysymDB is in SYS$COMMON:[syslib] and the file is called DECW$XKEYSYMBD.DAT.

The logical DECW$KEYMAP points to the directories where the keymap files are located. 4. How do I run uil2xd?

How do I run uil2xd or any of the other X-Designer's utility routines? The user's guide talks about standard input and standard output.

Unfortunately, the User's Guide is geared towards unix users. The VMS version of these utilities are modified to accept filenames instead of standard input and standard output.


Go to top of this page


I. Generated Code

1. Global access to the X-Designer generated static objects (Font, Pixmap, Colour)

How do I get Global access to the X-Designer generated static objects (Font, Pixmap, Colour)

The answer, and the problem, is that you need to insert some accessor functions into the xdesigner generated stream at a particular place, namely, after the type definitions for the font, colour, pixmap struct objects. The existing module and code preludes don't place the required code at the necessary location (near the initialise_objects function).

The work around is to "borrow" the pixmap include header for the purpose. This is generated at the right place. Since as we are using pixmap objects, replacing the pixmap object header with our own isn't that unusual.

Example

Suppose you have a need to access the following objects which we have added into the design:

        font objects:    FontA, FontB
	colour objects:  ColourA, ColourB
	pixmap object:   PixmapA
Create a header file "object_access.h" with the following accessor functions for this:
        XmFontList GetFontA() { return font_resources.FontA ; }
	XmFontList GetFontB() { return font_resources.FontB ; }

	Pixel   GetColourA()  { return pixel_resources.ColourA ; }
	Pixel   GetColourB()  { return pixel_resources.ColourB ; }
	Pixmap  GetPixmapA()  { return pixmap_resources.PixmapA ; }

Now we also need to ensure that the proper pixmap header gets included also, so place the normal pixmap inclusion #include "pixmaps.h" at the bottom.

All we need to do now is to generate code appropriately.

You need to generate pixmaps to an external file - generate to pixmaps.h as above. However, you need to specify that the Include Pixmaps File is NOT pixmaps.h, but "object_access.h".

In other words, we load the pixmaps.h file indirectly, using the fact that the pixmaps include statement is just at the right point to insert our code. The access functions themselves are all straightforward, as they are all based on the actual names of the objects as specified in xdesigner, and is thus easy to maintain separately from the normal generated code.

See the following example, which is available in the compressed tar archive faq_h1.tar.Z, for further explanation.

The contents of this example are:

        Example.xd   - a simple design with font, colour, pixmap objects
	Makefile     - to build the text rig
	code.c       - normal generated interface code
	stubs.c      - normal generated stubs - simple callback to use
			  the globally available functions
	externs.h    - normal generated externs header file
	pixmaps.h    - normal generated pixmaps header file
	main.c       - normal generated main module
	objects.h    - hand written code to create global objects.

     Note it includes "pixmaps.h"

The application simply creates two buttons - click on the pixmap button and it changes some font, colour, pixmaps using the global access functions.

Look at code.c - you will see that it includes "objects.h" at the right place - after the definitions of the object structures and before the initialise objects function.

Look at the overview dialog for C - you will see that the c code options has the include pixmaps header set not to pixmaps.h but to objects.h

This will all work every time you regenerate - the include objects.h statement will always be correctly placed, and will continue to work if you add new objects.

2. C++ generation white paper

A separate document containing information about generating C++.


Go to top of this page


J. uil2xd

1. Nothing seems to be happening!

I have waited over 10 minutes after running uil2xd and it does not seem to be doing anything!

uil2xd reads from standard input and writes to standard output. To use uil2xd, you must enter a command similar to the following:

uil2xd < input_file > output_file


Go to top of this page


K. Other

1. How to put an SCCS id into X-Designer generated files.

How can I put SCCS id into X-Designer's save file (.xd file) as well as into its generated files?

By placing the SCCS id into the Module Prelude's Heading section, it will be part of all the generated file as well as the .xd file. This is available from the "Module" pull down menu.


Go to top of this page


L. Sample code

1. Pop-up/pop-down dialogs

/* POPPING UP AND DOWN DIALOG SHELLS DYNAMICALLY */
/* Top Level Shell:     POPUP: XtPopup()           POPDOWN: XtPopdown()
*/
/* Application Shell:   POPUP: XtRealizeWidget()   POPDOWN:
XWithdrawWindow()  */
/* Dialog Shell:        POPUP: XtManageChild()     POPDOWN:
XtUnmanageChild()  */
#include <X11/Intrinsic.h>
#include <Xm/DialogS.h>
/* Retrieve Child of a Shell Widget */
/* Required for Dialog Popup        */
static Widget _find_shell_child(shell)
       Widget shell ;
{
  WidgetList children  = (WidgetList) 0 ;
  Cardinal   nchildren = 0 ;
  XtVaGetValues(shell, XmNnumChildren, &nchildren,
		XmNchildren,  &children, 0) ;
  if (children == (WidgetList) 0){
    /* No Shell Child */
    return (Widget) 0 ;
  }
  if (nchildren != 1) {
    /* Shells have Single Child   */
    /* Therefore it's not a shell */

    return (Widget) 0 ;
  }
  return children[0] ;
}
/* Retrieve Shell Widget at Top of Dialog */
static Widget _find_shell(widget)
       Widget widget ;
{
  register Widget w = widget ;
  while (w != (Widget) 0) {
    if (XtIsShell(w)) {

      break ;
    }
    w = XtParent(w) ;
  }
  return w ;
}
/* Popup a Dialog.                                       */
/* NB: This will work with ANY child of the dialog shell
*/
/*     or the dialog shell itself is passed.
*/
/* NEW IMPROVED VERSION: HANDLES ICONIFIED SHELLS
*/
Boolean popup_shell_dialog(widget, de_iconify)
  Widget  widget ;
  Boolean de_iconify ; /* If True,  Map the Iconified
	     Window If False, Popup MAY not
	     work if Iconified */
{
  register Widget  w ;
     Boolean iconic = False ;
  if ((w = _find_shell(widget)) == (Widget) 0) {
    return False ;
  }
  /* Application Shell Popup */
  if (XtIsApplicationShell(w)) {
    if (XtIsRealized(w)) {
      XtMapWidget(w) ;
    }
    XtRealizeWidget(w) ;
    /* Handle Iconic Case */
    if (de_iconify == True) {
      XtVaGetValues(w, XmNiconic, &iconic, 0) ;
      if (iconic == True) {
	XtVaSetValues(w, XmNiconic, False, 0) ;
	XRaiseWindow(XtDisplay(w), XtWindow(w))
;
      }
    }


    return True ;
  }
  /* Top Level Shell Popup */
  if (XtIsTopLevelShell(w)) {
    if (XtIsRealized(w)) {
      XtPopup(w,XtGrabNone) ;
    }
    else {
      XtRealizeWidget(w) ;
      XtPopup(w,XtGrabNone) ;
    }
    /* Handle Iconic Case */
    if (de_iconify == True) {
      XtVaGetValues(w, XmNiconic, &iconic, 0) ;
      if (iconic == True) {
	XtVaSetValues(w, XmNiconic, False, 0) ;
	XtMapWidget(w) ;
	XRaiseWindow(XtDisplay(w), XtWindow(w)) ;
      }
    }
    return True ;
  }
  /* Dialog Shell Popup */
  if (XmIsDialogShell(w)) {
    if ((w = _find_shell_child(w)) != (Widget) 0) {
      XtManageChild(w) ;

      return True ;
    }
  }

  return False ;
}
/* Popdown a Dialog.
*/
/* NB: This will work with ANY child of the dialog shell
*/
/*     or the dialog shell itself is
passed.                */
Boolean popdown_shell_dialog(widget)
  Widget widget ;

{
  register Widget w ;
  if ((w = _find_shell(widget)) == (Widget) 0) {
    return False ;
  }
  /* Popdown Application Shell */
  if (XtIsApplicationShell(w)) {
    if (XtIsRealized(w)) {
      XWithdrawWindow(XtDisplay(sh1), XtWindow(sh1),
		     ScreenNumberOfScreen(XtScreen(sh1))) ;

      return True ;
    }
    /* Not Realized, therefore not Mapped */

    return True ;
  }
  /* Popdown Top Level Shell */
  if (XtIsTopLevelShell(w)) {
    if (XtIsRealized(w)) {
      XtPopdown(w) ;

      return True ;
    }

    /* Not Realized, therefore not Mapped */

    return True ;
  }
  /* Popdown Dialog Shell */
  if (XmIsDialogShell(w)) {
    if ((w = _find_shell_child(w)) != (Widget) 0) {
      XtUnmanageChild(w) ;

      return True ;
    }
  }
  return False ;
}

2. Other There are other examples of code in $XDROOT/src/examples (see the README file there for details) and in the C++ generation white paper and the X-Designer and MFC paper.


Top of Page COPYRIGHT ©1995-2017 IST Reading Ltd. ALL RIGHTS RESERVED Legal Info | Privacy | Contact Us