3D PLM Enterprise Architecture

User Interface - Dialogs

CATDlgCombo

Selects an alphanumerical value in a discrete list
Quick Reference

CATDialog
  |
  +---CATDlgControl
        |
        +---CATDlgCombo

The Combo
CATDlgCombo.jpg (3268 bytes) The combo allows the end user to choose a value or an option by selecting a character string from a predefined list, or through a keyboard entry.

Use a combo whenever you propose to the end user to select an alphanumerical value from a discrete list, or enter an alphanumerical value to update a discrete list.


Styles
Name Display Description
default CATDlgCombo.jpg (3268 bytes) The standard combo, composed of an entry zone which displays the selected value, and a list permanently displayed.
CATDlgCmbDropDown CATDlgComboDropDown1.jpg (1432 bytes) The drop down combo, composed of an entry zone which displays the selected value, and the list of values to select in, displayed when the arrow located on the right of the entry zone is selected.
CATDlgCmbOptionStyle The option style combo, which is very near of the drop down combo with a Motif style. This type of combo is replaced by a CATDlgCmbDropDown combo with Windows.
CATDlgCmbEntry Allows for keyboard text entry in addition to text selection for drop down and standard combos.
CATDlgCmbDouble CATDlgComboDouble.jpg (3630 bytes) The entered number must be a double precision floating number.
CATDlgCmbColor CATDlgComboColor1.jpg (1531 bytes) Shows a color palette. Available in conjunction with CATDlgCmbDropDown only
CATDlgCmbLineType CATDlgComboLineType1.jpg (1444 bytes) Shows a linetype palette. Available in conjunction with CATDlgCmbDropDown only
CATDlgCmbBitmap Shows an icon palette. Available in conjunction with CATDlgCmbDropDown only

[Top]


Events
Notification Method Sent when
CATDlgComboSelectNotification GetComboSelectNotification Whenever a value is selected in the list.
CATDlgComboDropNotification GetComboDropNotification Whenever the list of values is displayed
Available with CATDlgCmbEntry only:
CATDlgComboModifyNotification GetComboModifyNotification Whenever the keyboard entry is modified by selection.
CATDlgEditModifyNotification GetEditModifyNotification Whenever the keyboard entry is modified by editing.

[Top]


Programmer's Guide

The combo is dedicated to executing a command when it is clicked.

[Top]

Constructing a Combo

These kinds of combo can be constructed, according to their different styles. Styles can be concatenated using the "|" character.

Standard combo
_pCombo            = new CATDlgCombo (iParent, iName);
DropDown combo
_pDropDownCombo    = new CATDlgCombo (iParent, iName,
                                   CATDlgCmbDropDown);
Option style combo
_pOptionStyleCombo = new CATDlgCombo (iParent, iName,
                                   CATDlgCmbOptionStyle);
Double number combo
_pDoubleCombo      = new CATDlgCombo (iParent, iName,
                                   CATDlgCmpDouble);
Color combo
_pColorCombo       = new CATDlgCombo (iParent, iName,
                               CATDlgCmbColor|CATDlgCmbDropDown);
Linetype combo
_pLinetypeCombo    = new CATDlgCombo (iParent, iName,
                               CATDlgCmbLineType|CATDlgCmbDropDown);
Bitmap combo
_pBitmapCombo      = new CATDlgCombo (iParent, iName,
                               CATDlgCmbBitmap|CATDlgCmbDropDown);

[Top]

Color Combo

CATDlgComboColor1.jpg (1531 bytes) A color combo displays a color palette that can contain up to 16 million colors. Colors are assigned for each line using the RGB values ranging each from 0 to 255 passed as parameters of the SetLine method. The selected or current color is displayed in the entry zone.
CATDlgComboColor2.jpg (4181 bytes) When the end user clicks on the arrow, the color palette is displayed and another color can be selected. The number of displayed colors is set using the SetVisibleTextHeight method.
CATDlgComboColor3.jpg (1578 bytes) A name can be assigned to each color. It is displayed beside the color.
CATDlgComboColor4.jpg (4233 bytes) The color names are read from the combo resource file. CATUnicodeString instances must be built from these names, and passed as parameters of the SetLine method.

[Top]

Linetype Combo

CATDlgComboLineType1.jpg (1444 bytes) A linetype combo displays a linetype palette. Linetypes are assigned for each line using a pixel pattern expressed using two bytes, a repeating factor of this pattern, and a width expressed as a pixel number, passed as parameters of the SetLine method. The selected or current linetype is displayed in the entry zone.
CATDlgComboLineType2.jpg (5443 bytes) When the end user clicks on the arrow, the linetype palette is displayed and another linetype can be selected. The number of displayed linetypes is set using the SetVisibleTextHeight method.
CATDlgComboLineType3.jpg (1512 bytes) A name can be assigned to each linetype. It is displayed beside the linetype.
CATDlgComboLineType4.jpg (6599 bytes) The linetype names are read from the combo resource file. CATUnicodeString instances must be built from these names, and passed as parameters of the SetLine method.

The linetype is built using a bit pattern, or mask, encoded on two bytes. This mask is shown below for Dashed, DotDashed, and Solid respectively.

CATDlgComboLinetype.gif (5090 bytes)

This mask can be used with a mapping of one pixel for one bit. Each bit can also be repeated on several pixels. This enlarges the mask. The linetype thickness is set as a number of pixels. The code that creates the combo shown above without the linetype names is as follows:

...
CATUnicodeString * pucsEmpty = new CATUnicodeString();
unsigned short Mask[8] = {0xffff, 0x3333, 0x7777, 0x0c3f, 0x5757, 0xcccc, 0x7ffb, 0x5bbc};
unsigned short Repeat[8] = {1, 4, 4, 2, 8, 1, 4, 4};

_pLinetypeCombo->SetLine(*pucsEmpty, Mask[0], Repeat[0], 1, 0);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[1], Repeat[1], 1, 1);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[2], Repeat[2], 1, 2);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[3], Repeat[3], 1, 3);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[4], Repeat[4], 1, 4);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[5], Repeat[5], 1, 5);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[6], Repeat[6], 1, 6);
_pLinetypeCombo->SetLine(*pucsEmpty, Mask[7], Repeat[7], 3, 7);
...

The fourth parameter is the thickness expressd in pixels. It is set to 1, except for the last linetype for which it is set to 3 pixels. The last parameter is the line number.

[Top]

Managing the Line Content

Lines in a combo are numbered beginning with 0.

[Top]

Managing the Line Display

To help manage the line display in the combo, you can use the following methods:

[Top]

Managing the Selection

You can manage the selection with the methods GetSelect, SetSelect, and ClearSelect:

get the selected line number
int SelectedLineNumber;
SelectedLineNumber = _pCombo->GetSelect();
set the selected line as the 9th line
int SelectedLineNumber = 8;
_pCombo->SetSelect(SelectedLineNumber);
clear the selection
_pCombo->ClearSelect();

[Top]

Managing the Keyboard Entry

You can manage the keyboard entry field with the methods GetField, SetField, and ClearField:

get the entry field
CATUnicodeString FieldText;
_pCombo->GetField(FieldText);
get the entry field for a double combo
double FieldValue;
FieldValue = _pDoubleCombo->GetField();
set the entry field
CATUnicodeString FieldText = ...;
_pCombo->SetField(FieldText);
set the entry field for a double combo
double FieldValue = 3.14159;
_pDoubleCombo->SetField(FieldValue );
clear the entry field
_pCombo->ClearField();

[Top]

Setting a Callback on a Combo

Set a callback on a non editable combo to be informed whenever the end user selects a value in the combo:

AddAnalyseNotificationCB(
  _pCombo,                                    // combo 
  _pCombo->GetComboSelectNotification(),      // notification
  (CATCommand)&Combo::MethodToExecute,        // method to execute 
  CATCommandClientData iUsefulData);          // useful data for this method 

[Top]

Setting a Title to a Combo

The combo title should be set by the resource file using a key built with the identifier you declare as the second parameter of the combo constructor. This title is never displayed. If you want to comment the choice available from the combo in your dialog, use a label.

[Top]


History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.