SilverScreen Solid Modeler

Panel Menus

Panel Menus

Previous topic Next topic  

Panel Menus

Previous topic Next topic JavaScript is required for the print function  



Panel Menus




Panel Menus are a simple means for constructing dialogs that request information from the user.  For SilverC development, this is the primary method for interface with the user.  For SilverEngine, SilverSharp, and SilverPlus, these menus offer a quick alternative to the construction of custom dialogs.

There are three steps required to use a panel menu:



The program executes pm_initialize . This establishes the title of the dialog and initiates the assembly process.


Lines of the dialog are sequentially assembled using the pm-family of functions. Each of these functions corresponds to a specific type of panel input. Among these are text entry, menu selection, color selection, and icon selection. The order in which these functions are called determines the order in which items appear in the panel.


The program executes pm_execute. This displays the panel and allows the user to input or edit items in the panel. When the user signals completion, pm_execute returns to the program. Updated panel values are then available.



There are 15 functions that define different types of panel input. Here is an overview of these functions:





Provides a button that will display a popup box. The item is then selected from the popup box.


Similar to pm_box


Prompts for a color value. The color value may be entered directly or may be selected via a button from a color bar, color palette, or a color slide


Inserts a line of descriptive text into the panel


Allows entry of an xyz-displacement. The displacement may be marked interactively via a button.


Allows entry of a distance. The distance may be marked interactively via a button


Allows entry of a real number.


Allows selection of a TrueType or SilverScreen font.


Allows entry of a real number. The number is displayed in any of the notations supported by SilverScreen.


This is a generalized selection entry that allows selection of items from 15 categories.


Allows entry of an integer value.


Allows selection of an item from a menu. The item is selected by pointing at the desired item.


Prompts for a RGB value. The RGB maybe entered directly, or may be selected via a button from a color bar, color palette, or a color slide.


Allows entry of a text string.


Allows entry of an xyz-coordinate. The coordinate may be marked interactively via a button.



A short example illustrating the use of panels:


C / C++ Code


 // Establish panel title

 pm_initialize ( "Machine Specification" );


 // Initial values

 machine_size = 1;

 width = 10.0;

 machine_color = color_blue;


 // Items to appear in panel

 pm_menu ( "Machine size", "Small Medium Large", &machine_size );

 pm_double ( "Machine width", &width, 1 );

 pm_color ( "Machine color", &machine_color );


 // Display panel and edit

 if ( pm_execute () )

    ss_command ( "note User signaled successful completion" );


    ss_command ( "note User terminated by cancellation" );



The initial values for machine_size , width , and machine_color will be used to initialize the panel. Values will be returned in these variables if pm_execute returns TRUE.