SilverScreen Solid Modeler

Panel Menus

Panel Menus

Previous topic Next topic  

Panel Menus

Previous topic Next topic JavaScript is required for the print function  

SilverScreenAPI

 

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:

 

1.

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

2.

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.

3.

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:

 

Function

Description

pm_box

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

pm_box2

Similar to pm_box

pm_color

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

pm_comment

Inserts a line of descriptive text into the panel

pm_displacement

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

pm_distance

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

pm_double

Allows entry of a real number.

pm_font

Allows selection of a TrueType or SilverScreen font.

pm_formatted

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

pm_generic

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

pm_integer

Allows entry of an integer value.

pm_menu

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

pm_rgb

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.

pm_text

Allows entry of a text string.

pm_xyz

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" );

 else

    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.