Use Windows.pkg Use MessageQueueHelpers.pkg Use THDialog.pkg Object oReplaceDialog is a ModalPanel Set Label to "Find & Replace" Set Size to 98 300 Set piMinSize to 95 300 Set Location to 44 47 Set Border_Style to Border_Thick //Set Locate_Mode to POPUP_LOCATE -- locate mode isn't smart enough Property Boolean pbReplaceAll Property Boolean pbFindFirst Property Handle phoInvokingObject Set peAnchors to anAll Set piMaxSize to 100 8000 Object oFindFm is a cFindComboForm Set Size to 13 185 Set Location to 10 55 Set Label to "&Find:" Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set peAnchors to anTopLeftRight End_Object Object oReplaceFm is a cFindComboForm Set Size to 13 185 Set Location to 26 55 Set Label to "Re&place with:" Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set peAnchors to anTopLeftRight End_Object Object oWordMatchCb is a cFindCheckBox Set Size to 10 50 Set Location to 46 55 Set Label to "Match &whole word only" End_Object Object oMatchCaseCb is a cFindCheckBox Set Size to 10 50 Set Location to 57 55 Set Label to "Match &case" End_Object Object oRegExCb is a cFindCheckBox Set Size to 10 50 Set Location to 68 55 Set Label to "Regular &expression" End_Object Object oCaseCb is a cFindCheckBox Set Size to 10 50 Set Location to 79 55 Set Label to "Preser&ve case" End_Object Object oDocumentStartCb is a cFindCheckBox Set Size to 10 50 Set Location to 80 55 Set Label to "Start at first &line" End_Object Object oReplaceGrp is a RadioGroup Set Size to 42 85 Set Location to 46 155 Set Label to "Replace in" Set peAnchors to anTopLeftRight Object oRplSelection is a Radio Set Size to 10 50 Set Location to 14 10 Set Label to "&Selection" End_Object Object oRplBuffer is a Radio Set Size to 10 50 Set Location to 26 10 Set Label to "Entire &Buffer" End_Object End_Object Object oFindBtn is a Button Set Label to "Find &Next" Set Location to 10 245 Set peAnchors to anTopRight Set Default_State to True Procedure OnClick Handle hoInvokingObject Integer iFlags String sSearchText tFindReplaceOptions ReplaceOptions Get phoInvokingObject to hoInvokingObject If hoInvokingObject Begin Send SettingsToOptions (&ReplaceOptions) Get SetSearchOptions of hoInvokingObject ReplaceOptions to iFlags Get Value Of oFindFm To sSearchText Send AddSearchString of oFindFm sSearchText // make sure the search value is saved in the array Set psSearchText of hoInvokingObject to sSearchText If (ReplaceOptions.bDocumentStart=True and pbFindFirst(Self)=false) Begin Set pbFindFirst to True Send FindFirst to hoInvokingObject End Else Begin Send FindNext to hoInvokingObject End End End_Procedure End_Object Object oReplaceBtn is a Button Set Location to 26 245 Set peAnchors to anTopRight Set Label to "&Replace" Procedure OnClick Handle hoInvokingObject String sSearchText String sReplaceWith Get phoInvokingObject to hoInvokingObject If hoInvokingObject Begin Get Value of oFindFm to sSearchText Get Value Of oReplaceFm To sReplaceWith Send AddSearchString of oReplaceFm sReplaceWith // save the replace string in the array for later use if wanted Set psSearchText of hoInvokingObject to sSearchText Send ReplaceText of hoInvokingObject sReplaceWith Send FindNext to hoInvokingObject End End_Procedure End_Object Object oReplaceAllBtn is a Button Set Location to 42 245 Set peAnchors to anTopRight Set Label to "Replace &All" Procedure OnClick Set pbReplaceAll to True Send Close_Panel End_Procedure End_Object Object oCancelBtn is a Button Set Label to "&Cancel" Set Location to 58 245 Set peAnchors to anTopRight Procedure OnClick Send Close_Panel End_Procedure End_Object Procedure doFind Send DispatchHotkey Send KeyAction of oFindBtn End_Procedure Procedure doReplace Send DispatchHotkey Send KeyAction of oReplaceBtn End_Procedure Procedure doReplaceAll Send DispatchHotkey Send KeyAction of oReplaceAllBtn End_Procedure On_Key Key_Alt+Key_F Send Activate of oFindFm On_Key Key_Alt+Key_P Send Activate of oReplaceFm On_Key Key_Alt+Key_W Send doToggle of oWordMatchCb On_Key Key_Alt+Key_C Send doToggle of oMatchCaseCb On_Key Key_Alt+Key_E Send doToggle of oRegExCb On_Key Key_Alt+Key_L Send doToggle of oDocumentStartCb On_Key Key_Alt+Key_N Send doFind On_Key Key_Alt+Key_R Send doReplace On_Key Key_Alt+Key_A Send doReplaceAll On_Key kCancel Send KeyAction of oCancelBtn Procedure SettingsToOptions tFindReplaceOptions ByRef Options Get Value of oFindFm to Options.sSearchText Get Value of oReplaceFm to Options.sReplaceText Get Checked_State of oWordMatchCb to Options.bWordMatch Get Checked_State of oMatchCaseCb to Options.bMatchCase Get Checked_State of oRegExCb to Options.bRegExp Get Checked_State of oDocumentStartCb to Options.bDocumentStart Get Current_Radio of oReplaceGrp to Options.eFindOptions Move False to Options.bMarkAll End_Procedure Procedure RequestDetails tFindReplaceOptions ByRef Options Handle hoInvokingObject Boolean bReplaceAll If (hoInvokingObject=0) Procedure_Return Set phoInvokingObject to hoInvokingObject // Set pbReplaceAll to False Set pbFindFirst to False Move False to Options.bReplaceAll Set SearchValue of oFindFm to Options.sSearchText Set Checked_State of oWordMatchCb to Options.bWordMatch Set Checked_State of oMatchCaseCb to Options.bMatchCase Set Checked_State of oRegExCb to Options.bRegExp Set Checked_State of oDocumentStartCb to Options.bDocumentStart Send Popup Send SettingsToOptions (&Options) Get pbReplaceAll to bReplaceAll If (bReplaceAll) Begin Move True to Options.bReplaceAll End End_Procedure #IFDEF TH_TRANSLATION Procedure Translate Set Label to gILanguage[863] Set Label of oFindFm to gILanguage[864] Set Label of oReplaceFm to gILanguage[865] Set Label of oWordMatchCb to gILanguage[866] Set Label of oMatchCaseCb to gILanguage[867] Set Label of oRegExCb to gILanguage[868] Set Label of oCaseCb to gILanguage[869] Set Label of oReplaceGrp to gILanguage[870] Set Label of (oRplSelection(oReplaceGrp(Self))) to gILanguage[871] Set Label of (oRplBuffer(oReplaceGrp(Self))) to gILanguage[872] Set Label of oFindBtn to gILanguage[873] Set Label of oReplaceBtn to gILanguage[874] Set Label of oReplaceAllBtn to gILanguage[875] Set Label of oCancelBtn to gILanguage[876] End_Procedure #ENDIF Procedure Activating Forward Send Activating #IFDEF TH_TRANSLATION Send Translate #ENDIF End_Procedure End_Object