Stata 15 help for dialog_undocumented

Title

[P] dialog programming -- Dialog programming

Description

Dialog-box programs -- also called dialog resource files -- allow you to define the appearance of a dialog box, specify how its controls work when the user fills it in (such as hiding or disabling specific controls), and specify the ultimate action to be taken (such as running a Stata command) when the user clicks on OK or Submit. Below are undocumented features of dialog-box programs.

Remarks

Remarks are presented under the following headings:

1. Controls 1.1 TREEVIEW tree input control 1.2 EXP expression input control 1.3 Display system fonts in COMBOBOX list input control

2.Built-in member functions for dialog boxes

3.Built-in member functions for dialogs

4. Properties

5. Utilities

1. Controls

1.1 TREEVIEW tree input control

The full documentation for TREEVIEW can be found in [P] dialog programming; see 3.6.17 TREEVIEW tree input control.

Syntax

TREEVIEW newcontrolname x y xsize ysize [, label("string") error("string") nomemory contents(conspec) values(listname) default(defstrval) ondblclick(iaction) [onselchange(iaction)|onselchangelist(listname)] option(optionname) tooltip("string")]

Undocumented option

idx_to_parent specifies that the integer portion from the list specification takes on a new meaning. The first part encloses a nonnegative integer in square brackets to denote the relationship of the nodes. A 0 means that this item is a root of the tree. Other nonzero integers mean that the item is a child of another node. For instance, k means that the item is a child node of the kth element in the content list. The second part following the square brackets is the content shown in the tree.

Example

LIST ourcontentlist BEGIN [0]Root 1 [1]SubItem A [2]SubItem A1 [2]SubItem A2 [1]SubItem B [0]Root 2 [6]SubItem C END . . . DIALOG . . . BEGIN . . . TEXT ourlab 10 10 200 ., label("Pick an item") TREEVIEW ourtree @ +20 150 200, contents(ourcontentlist) . . . END

By default, nodes are specified by their depth.

1.2 EXP expression input control

The full documentation for EXP can be found in [P] dialog programming; see 3.6.15 EXP expression input control.

Syntax

EXP newcontrolname x y xsize ysize [, label("string") error("string") default(defstrval) nomemory onchange(iaction) option(optionname) tooltip("string")]

Undocumented options

matrixonly specifies that only the estimation results matrices, return results matrices, user-defined matrices, and matrix functions tree-view categories be displayed in the expression builder.

simple specifies that only the functions, coefficients, estimation results, return results, macros, and scalar tree-view categories be displayed in the expression builder.

parameter adds the category parameters to the tree-view categories display in the expression builder.

1.3 Display system fonts in COMBOBOX list input control

The combo box will contain all available fonts for the current operating system when the contents list is initialized with fonts

COMBOBOX newcontrolname x y xsize ysize, contents(fonts)

The full documentation for COMBOBOX can be found in [P] dialog programming; see 3.6.8 COMBOBOX list input control.

Undocumented member function for COMBOBOX list input control

.loadfontstyles causes a COMBOBOX control to load all available font styles for a specific font that was selected from a COMBOBOX control that uses fonts as its contents list. To display font styles, you must have two COMBOBOX controls. The first combo box uses the contents list specified by fonts to load the operating system fonts; the second combo box uses .loadfontstyles to load the font styles for the chosen font into its own contents list.

Example DIALOG sample BEGIN . . . COMBOBOX cb_font 10 10 150 110, contents(fonts) /// label("Font") onselchange(program style_change) COMBOBOX cb_style 180 @ 150 110, label("Style") /// contents(font_style_list) . . . END

LIST font_style_list BEGIN Regular Bold Italic Bold Italic END . . . PROGRAM style_change BEGIN . . . call sample.cb_font.withvalue sample.cb_style.loadfontstyles "@" . . . END 2. Built-in member functions for dialog boxes

The built-in functions below operate on a dialog resource, otherwise known as a dialog box.

The built-in functions are the following:

.Submit causes the dialog box to submit its current command string to Stata. This is equivalent to clicking on the Submit button in the dialog box.

.GetSubmit causes the dialog box to process the u-action associated with the Submit button and display the contents of the command string. Alternatively, the name of a previously declared STRING property can be supplied to receive the contents of the command string.

.Ok causes the dialog box to submit its current command string to Stata and close. This is equivalent to clicking on the Ok button in the dialog box.

.Reset causes the dialog box to reset. This is equivalent to clicking on the (R) button in the dialog box.

.Cancel causes the dialog box to close. This is equivalent to clicking on the Cancel button in the dialog box.

.Execute executionstring causes the dialog box to execute some task specified by executionstring. Usually, this is a script or program defined in the dialog box.

Example:

dlgresource.Execute "program main_hide_controls"

.SaveState causes the dialog box to save its current state. This happens automatically when the Submit or OK button is clicked on in the dialog box.

3. Built-in member functions for dialogs

The built-in functions below operate on dialogs, otherwise known as dialog tabs.

The built-in functions are

.setactive causes a tab to become active. This is equivalent to clicking on the button associated with a dialog tab.

4. Properties

SVECTOR is a vector property that can store up to 1000 string values.

Member functions:

type member functions ---------------------------------------------------------------------- SVECTOR propertyname.dropall propertyname.copyFromArray classArrayName propertyname.copyToArray classArrayName propertyname.copyToString stringPropertyName propertyname.findstr strvalue propertyname.store # strvalue propertyname.swap # # ---------------------------------------------------------------------- Note: propertyname.findstr sets the position data member to the index of the first matching strvalue, or 0 if the strvalue is not found.

5. Utilities

_dialog discard [objectname] causes the dialog specified by dlgname and all of its class system objects to be destroyed. If a dlgname is not specified, all dialogs and their class system objects will be destroyed.


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index