Page 1 of 1

Find text in editbox

Posted: Sun Jan 28, 2024 1:10 pm
by serge_girard
Hello,

Anybody knows how to search and re-search a piece of text within an editbox.

I now have this code which works fine except to continue search is not feasible with AT function:

Code: Select all

c_EDITBOX_TEXT := Form_TXT.EDITBOX_TEXT.Value // very long text
x_SEARCH_TXT   := Form_TXT.SEARCH_TXT.Value   // some short text to be found

nPOS   := AT(UPPER(x_SEARCH_TXT), UPPER(c_EDITBOX_TEXT))
TextBoxEditSetSel( 'Form_TXT', 'EDITBOX_TEXT', nPOS-1, ( nPOS-1  + LEN(x_SEARCH_TXT)))
Form_TXT.EDITBOX_TEXT.Setfocus
...


/* this comes from Mr. Claudio SOTO */
FUNCTION TextBoxEditSetSel( cParent, cControl, nStart, nEnd )
/***********************************************************/
LOCAL nHandle := GetControlHandle( cControl, cParent )
TextBoxSetSel( nHandle, nStart, nEnd )
RETURN nil

#pragma BEGINDUMP
#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"
#include <wingdi.h>

HB_FUNC ( TEXTBOXSETSEL )
{
   HWND hWnd1;
   hWnd1 = (HWND) hb_parnl (1);
   SendMessage((HWND) hWnd1,EM_SETSEL, (WPARAM)(int) hb_parni(2),(LPARAM) (int) hb_parni(3));
}


Re: Find text in editbox

Posted: Sun Jan 28, 2024 2:45 pm
by gfilatov
serge_girard wrote: Sun Jan 28, 2024 1:10 pm Hello,

Anybody knows how to search and re-search a piece of text within an editbox.
Hello Serge,

Thanks for your request.

We have this feature in the example from the minigui\SAMPLES\BASIC\EDITBOX folder. :arrow:

Re: Find text in editbox

Posted: Sun Jan 28, 2024 4:37 pm
by serge_girard
Thanks !

Re: Find text in editbox

Posted: Tue Jan 30, 2024 3:44 am
by AUGE_OHR
hi,

under HMG you have FindReplace Dialog
see under

C:\hmg.3.4.4\SAMPLES\Applications\MiniWriter\miniwriter.prg
C:\hmg.3.4.4\SAMPLES\Controls\RichEditBox\demo.prg
C:\hmg.3.4.4\SAMPLES\HFCL\WordScribe\WordScribe.prg
C:\hmg.3.4.4\SAMPLES\HFCL\WordWriter\WordWriter.prg
C:\hmg.3.4.4\SAMPLES\MultiThread\MT_RichEditBox\MT_RichEditBox.prg

Re: Find text in editbox

Posted: Tue Jan 30, 2024 8:05 am
by serge_girard
Thx Jimmy !