Table Of Contents

Previous topic

PySimpleApp

Next topic

QueryNewPaletteEvent

This Page

phoenix_title PySingleChoiceDialog

This class represents a dialog that shows a list of strings, and allows the user to select one.

Double-clicking on a list item is equivalent to single-clicking and then pressing OK.

styles Window Styles

This class supports the following styles:

  • OK: Show an OK button.
  • CANCEL: Show a Cancel button.
  • CENTRE: Centre the message. Not Windows.

class_hierarchy Inheritance Diagram

Inheritance diagram for class PySingleChoiceDialog

Inheritance diagram of PySingleChoiceDialog


method_summary Methods Summary

__init__ Constructor, taking an array of String choices and optional client data.
GetSelection Returns the index of selected item.
GetStringSelection Returns the selected string.
SetSelection Sets the index of the initially selected item.
ShowModal Shows the dialog, returning either ID_OK or ID_CANCEL.

api Class API



class PySingleChoiceDialog(Dialog)

This class represents a dialog that shows a list of strings, and allows the user to select one.

Possible constructors:

PySingleChoiceDialog(parent, message, caption, choices,
                     style=CHOICEDLG_STYLE, pos=DefaultPosition)

Methods



__init__(self, *args, **kw)

Constructor, taking an array of String choices and optional client data.

Parameters:
  • parent (Window) – Parent window.
  • message (string) – Message to show on the dialog.
  • caption (string) – The dialog caption.
  • choices (list of strings) – An array of strings, or a string list, containing the choices.
  • style (long) – A dialog style (bitlist) containing flags chosen from standard dialog styles and the ones listed in the class documentation. The default value is equivalent to DEFAULT_DIALOG_STYLE | RESIZE_BORDER | OK | CANCEL | CENTRE.
  • pos (Point) – Dialog position. Not Windows.

An array of client data to be associated with the items. See GetSelectionData .

Note

Use ShowModal to show the dialog.



GetSelection(self)

Returns the index of selected item.

Return type:int


GetStringSelection(self)

Returns the selected string.

Return type:string


SetSelection(self, selection)

Sets the index of the initially selected item.

Parameters:selection (int) –


ShowModal(self)

Shows the dialog, returning either ID_OK or ID_CANCEL.

Return type:int

Properties



Selection

See GetSelection and SetSelection



StringSelection

See GetStringSelection