Find text in editbox

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3167
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Find text in editbox

Post 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));
}

There's nothing you can do that can't be done...
User avatar
gfilatov
Posts: 1069
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Find text in editbox

Post 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:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
serge_girard
Posts: 3167
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Find text in editbox

Post by serge_girard »

Thanks !
There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Find text in editbox

Post 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
have fun
Jimmy
User avatar
serge_girard
Posts: 3167
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Find text in editbox

Post by serge_girard »

Thx Jimmy !
There's nothing you can do that can't be done...
Post Reply