Page 1 of 1
Error Sample c:\fwh\samples\dlgfind.prg
Posted: Tue Mar 28, 2023 4:10 pm
by Jimmy
hi,
i try to use Sample but it crash ...
Error description: Error BASE/3012 Argument error: NUMTOHEX
Args:
[ 1] = U
[ 2] = N 6
Stack Calls
===========
Called from: => NUMTOHEX( 0 )
Called from: .\source\function\VALBLANK.PRG => FW_CLRTOHTML( 318 )
Called from: .\source\classes\DIALOG.PRG => TDLGFIND:HTML( 421 )
Called from: .\source\classes\DIALOG.PRG => TDLGFIND:INITIATE( 955 )
Called from: .\source\classes\DLGFIND.PRG => TDLGFIND:NEW( 48 )
Called from: .\source\classes\DLGFIND.PRG => DLGFINDTEXT( 65 )
Called from: dlgfind.prg => MAIN( 13 )
p.s. it does show Dialog so i saw it before crash
Re: Error Sample c:\fwh\samples\dlgfind.prg
Posted: Tue Mar 28, 2023 6:39 pm
by karinha
Look, c:\fwh..\samples\fivedit.prg
Regards, saludos.
Re: Error Sample c:\fwh\samples\dlgfind.prg
Posted: Mon Apr 03, 2023 8:42 am
by Jimmy
hi,
here working CODE
Code: Select all | Expand
// Class TDlgFind test
#include "FiveWin.ch"
function Main()
local oWnd, oGet, cMemo := "This is a test in GET"
local bSearch, cFind := "test" // add this
DEFINE WINDOW oWnd
@ 2, 2 GET oGet VAR cMemo SIZE 200, 25
oWnd:lHtml := .F. // add this
bSearch := {|| FindTXTProc( oGet, cFind, cMemo ) } // add this
DlgFindText( cFind, oGet, bSearch ) // NEED 3rd Parameter
ACTIVATE WINDOW oWnd CENTER
return nil
Code: Select all | Expand
PROCEDURE FindTXTProc( oGet, cFind , cMemo )
LOCAL nPosi
STATIC nStartReplace := 1
nPosi := hb_at( UPPER( cFind ), UPPER( cMemo ), nStartReplace )
IF nPosi > 0
// must setfocus else NO Color
oGet:Setfocus()
oGet:SetSel( nPosi - 1, nPosi + LEN( cFind ) - 1 )
// for next Position
nStartReplace := nPosi + 1
ELSE
MsgInfo("no found")
ENDIF
RETURN
Re: Error Sample c:\fwh\samples\dlgfind.prg
Posted: Mon Apr 03, 2023 10:37 am
by karinha
Code: Select all | Expand
// C:\FWH...\SAMPLES\DLGFIND2.PRG Para FWH22.06 o Superior. By Jimmy.
// Class TDlgFind test
#Include "FiveWin.ch"
FUNCTION Main()
LOCAL oWnd, oGet, cMemo := "This is a test in GET"
LOCAL bSearch, cFind := "test" // add this
DEFINE WINDOW oWnd
@ 2, 2 GET oGet VAR cMemo SIZE 200, 25
// oWnd:lHtml := .F. // add this
#IF ( FW_VersionNo >= 22060)
tWindow():lHtml := .F. // FALSE
#ENDIF
bSearch := {|| FindTXTProc( oGet, cFind, cMemo ) } // add this
DlgFindText( cFind, oGet, bSearch ) // NEED 3rd Parameter
ACTIVATE WINDOW oWnd CENTERED
RETURN NIL
PROCEDURE FindTXTProc( oGet, cFind, cMemo )
LOCAL nPosi
STATIC nStartReplace := 1
#ifdef __XHARBOUR__ // xHarbour
nPosi := At( Upper( cFind ), Upper( cMemo ), nStartReplace )
#else
nPosi := hb_At( Upper( cFind ), Upper( cMemo ), nStartReplace )
#endif
IF nPosi > 0
// must setfocus else NO Color
oGet:Setfocus()
oGet:SetSel( nPosi - 1, nPosi + Len( cFind ) - 1 )
// for next Position
nStartReplace := nPosi + 1
ELSE
MsgInfo( "no found" )
ENDIF
RETURN NIL
// FIN / END
Regards, saludos.