Find Dialog

Find Dialog Sample

Creating the Dialog

Create a Find Dialog by calling dialog.findDialog with the one required and any or all of the three optional arguments shown in the table below:


Example:

Above dialog was created with this line of code:

result = dialog.findDialog(self)

Argument

Data type/Notes

self

the window (background) that is the parent for the dialog

OPTIONAL searchText

String defining the text for which to search

OPTIONAL wholeWordsOnly

Boolean value indicating whether to confine the search to strings that contain the search text as a whole word rather than a substring. True = search for whole words only; False = find all occurrences of the search text

OPTIONAL caseSensitive

Boolean value indicating whether to confine the search to strings that contain the search text exactly as provided including upper and lower case letter sensitivity.. True = search for exact capitalization match; False = find all occurrences of the search text

Interacting With the Dialog

The findDialog component returns four values, stored as elements of the Python dictionary called "results" returned by all PythonCard dialogs. These results are as shown in the following table.

Name of value
Description
accepted
True = user clicked OK
False = user clicked Cancel
searchText
String containing the text entered by the user for which the search is to be conducted
wholeWordsOnly
True = user checked "Whole Words Only" checkbox
False = user did not check the checkbox
caseSensitive
True = user checked "Case Sensitive" checkbox
False = user did not check the checkbox

Example:

The sample dialog shown at the top of this page returns the following results:

accepted: True
searchText: PythonCard
wholeWordsOnly: True
caseSensitive: False