TDlgFind
Source: source/classes/dlgfind.prg
Inherits from: TDialog
TDlgFind wraps the standard Windows Find Text common dialog (FindText API). It is a modeless dialog managed by Windows that allows users to search for text within an application. The dialog sends notification messages back to the caller when the user clicks "Find Next".
Methods
| Method | Description |
|---|---|
New( cText, oWnd, bSearch ) | Create the Find dialog with initial text, owner window, and search action block |
Free Function
| Function | Description |
|---|---|
DlgFindText( cText, oWnd, bSearch ) -> oDlg | Convenience function that creates and returns a TDlgFind object |
Example: Find Dialog with Search Callback
#include "FiveWin.ch"
function Main()
local oWnd, oDlg
DEFINE WINDOW oWnd TITLE "Find Demo" SIZE 600, 400
oDlg = DlgFindText( "search text", oWnd, {|cText,lDir| MySearch( cText, lDir ) } )
ACTIVATE WINDOW oWnd CENTERED
return nil
function MySearch( cText, lForward )
// Perform search in your edit control
? "Searching for:", cText, If( lForward, "forward", "backward" )
return nil
Notes
- The Find dialog is modeless (
lModal = .F.). The application continues processing while it is open. - The
bSearchblock receives the search text and a logical direction flag (.T. = forward, .F. = backward). - The dialog is automatically centered within its owner window.
- Internally, the
FindText()Windows API creates the dialog; TDlgFind subclasses it viaRegDialog()to handle events.