3
__version__ = "$Revision: 1.2 $"
4
__date__ = "$Date: 2004/08/12 19:12:39 $"
7
from PythonCard import dialog, model
9
class FindDialog(model.CustomDialog):
10
def __init__(self, aBg, searchText='', wholeWordsOnly=0, caseSensitive=0,
11
searchField=None, searchableFields=None):
12
model.CustomDialog.__init__(self, aBg)
16
# if some special setup is necessary, do it here
17
self.components.fldFind.text = searchText
18
self.components.chkMatchWholeWordOnly.checked = wholeWordsOnly
19
self.components.chkMatchCase.checked = caseSensitive
20
if searchableFields is None:
21
self.components.popSearchField.visible = False
23
searchableFields.insert(0, 'All')
24
self.components.popSearchField.items = searchableFields
25
if searchField is None:
26
self.components.popSearchField.stringSelection = 'All'
28
self.components.popSearchField.stringSelection = searchField
29
self.components.fldFind.setSelection(0, len(self.components.fldFind.text))
30
#self.components.fldFind.SetMark(-1, -1)
31
self.components.fldFind.setFocus()
33
def findDialog(parent, searchText='', wholeWordsOnly=0, caseSensitive=0,
34
searchField=None, searchableFields=None):
35
dlg = FindDialog(parent, searchText, wholeWordsOnly, caseSensitive,
36
searchField, searchableFields)
37
result = dlg.showModal()
38
result.searchText= dlg.components.fldFind.text
39
result.wholeWordsOnly = dlg.components.chkMatchWholeWordOnly.checked
40
result.caseSensitive = dlg.components.chkMatchCase.checked
41
sel = dlg.components.popSearchField.stringSelection
42
if searchableFields is None or sel == 'All':
43
result.searchField = None
45
result.searchField = sel