GXDGW class

class GXDGW(handle=0)

GXDGW class.

Provides access to dialog boxes for user I/O. You can use this class to store to, or retrieve information from the current workspace parameter block via dialog boxes

Note:

Setting Fonts in GX dialogs.

By default, “new look” GX dialogs uses the “Tahoma” font. This font can be overridden by updating the application settings. This can be done programmatically using the GXSYS.global_set function using the following parameters:

MONTAJ.GX_FONT=”Font_name”

This sets the default font to “Font_name”. It applies to text in all components of the dialog.

Additional customization of individual components can be accomplished using the following parameters:

MONTAJ.GX_CAPTION_FONT=”Caption_Font”: Font for the field captions (labels) MONTAJ.GX_BUTTON_FONT=”Button_Font” : Font for buttons, including the “Browse” button MONTAJ.GX_TITLE_FONT=”Title_Font” : Font for special titles (see set_title).

The font used for the text in edit windows remains the default, or the value specified using MONTAJ.GX_FONT.

Note that the “OK” button, and the Title, use “Bold” versions of the specified font. If the bolded version does not exist as a normal font, then the operating system may provide its own alternative which may not appear the same as you expect.

Before version 6.2. there used to be a parameter, MONTAJ.GX_CHARSET, that affected characters above ASCII 127. 6.2. introduced Unicode in the core montaj engine that eliminated the need for such a setting. All strings on the GX API level are encoded in UTF8 constants during runtime which makes it possible to represent all possible characters without using character sets.

classmethod create(name)

This method creates a Dialog window from a specified resource. The Resource is loaded into memory but not displayed.

Parameters:name (str) – Name of the Window Resource to use
Returns:Handle to the GXDGW object.
Return type:GXDGW

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_info_meta(obj, dlg_obj_type, meta, meta_obj, meta_attrib)

Copies the Dialog information to a GXMETA attribute.

Parameters:
  • obj (int) – Dialog Object
  • dlg_obj_type (int) – DGW_OBJECT constants
  • meta_obj (int) – Object
  • meta_attrib (int) – Attribute

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_info_sys(id, info, group, field)

This method uses the information in a Dialog box to set a GXSYS variable.

Parameters:
  • id (int) – Dialog Object
  • info (int) – DGW_OBJECT constants
  • group (str) – Group name of the Variable
  • field (str) – Variable name

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_list(id)

This method retrieves the list (GXLST) object associated with a Dialog object.

Parameters:id (int) – Dialog Object
Returns:The List Object
Return type:GXLST

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

gt_info(id, info, buff)

This method fills the specified string with the text from the text object specified.

Parameters:

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod null()

A null (undefined) instance of GXDGW

Returns:A null GXDGW
Return type:GXDGW
run_dialogue()

This method runs the Dialog window.

Returns:The Exit Code of the Dialog window.
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_info(id, info, buff)

This method sets the string of a text object. If the string is too long it will be truncated.

Parameters:
  • id (int) – Handle to the TEXT Object
  • info (int) – DGW_OBJECT constants
  • buff (str) – String to set the Text To

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_info_meta(obj, dlg_obj_type, meta, meta_obj, meta_attrib)

This sets a text object to the text found in a GXMETA attribute.

Parameters:
  • obj (int) – Dialog Object
  • dlg_obj_type (int) – DGW_OBJECT constants
  • meta_obj (int) – Object
  • meta_attrib (int) – Attribute

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_info_sys(id, info, group, field)

This sets a text object to the text found in a system parameter variable. If the variable has not been set, the text is not set.

Parameters:
  • id (int) – Dialog Object
  • info (int) – DGW_OBJECT constants
  • group (str) – Group name of the Variable
  • field (str) – Variable name

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_title(title)

Changes the title of the dialog.

Parameters:title (str) – Title to set

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: A “Special”, additional title can be added to a dialog by passing a title to set_title with the following syntax:

"Window Title\nAdditional Title"

In the title argument, a line break character '\n' is used to separate the parts.

The window title free_appears as the title in the upper bar of the dialog. The additional title free_appears below this, in the main body of the dialog, and is separated from the rest of the fields by a horizontal line. It is printed in the bold version of the default font (or of the special font specified using the MONTAJ.GX_TITLE_FONT parameter noted above in “Setting Fonts in GX dialogs.”

DGW_OBJECT constants

Dialog object defines INFO TYPE EDIT FEDIT LEDIT CEDIT EBUT ========= ===== ===== ===== ===== ===== LABEL RW RW RW RW RW R - can use GetInfo_DGW TEXT RW RW RW RW . W - can use set_info PATH . RW . . . FILEPATH . RW . . . LISTVAL . . R . . LISTALIAS . . RW . .

DGW_LABEL

The text label tied to each Dialog component.

gxapi.DGW_LABEL = 0
DGW_TEXT

The edit field text.

gxapi.DGW_TEXT = 1
DGW_PATH

The file edit path.

gxapi.DGW_PATH = 2
DGW_FILEPATH

The complete file name, path included.

gxapi.DGW_FILEPATH = 3
DGW_LISTVAL

The alias value associated with the list entry.

gxapi.DGW_LISTVAL = 4
DGW_LISTALIAS

The text value associated with the list entry.

gxapi.DGW_LISTALIAS = 5
DGW_EXT

The extension associated with a filename entry.

gxapi.DGW_EXT = 7
DGW_HIDE

Hide the button or entry and its label, if string is not “0”

gxapi.DGW_HIDE = 8