Função para localizar um texto em um richedit
Moderador: Moderadores
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Usei um recurso não muito comum do FOR/EACH, pra trocar as letras problemáticas. Agora foi.
Isso foi para este problema específico.. Se for usar pra outra coisa, bloqueie a gravação e faça testes primeiro, porque outro fonte pode conter caracteres que aqui não foram usados.
Será que este não é o problema do ASimões com HWGUI 2.20 ?
Isso foi para este problema específico.. Se for usar pra outra coisa, bloqueie a gravação e faça testes primeiro, porque outro fonte pode conter caracteres que aqui não foram usados.
Será que este não é o problema do ASimões com HWGUI 2.20 ?
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
ASimões, peguei novamente o seu fonte, o primeiro post.
Os caracteres estão lá.
Inclusive, tem dois que foram propositais, acho que isso não se faz em fonte, mas tudo bem, encontrou muito mais que dois caracteres.
Acrescentei até a posição da letra dentro do fonte, só pra tirar dúvida.
Os caracteres estão lá.
Inclusive, tem dois que foram propositais, acho que isso não se faz em fonte, mas tudo bem, encontrou muito mais que dois caracteres.
Acrescentei até a posição da letra dentro do fonte, só pra tirar dúvida.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Aproveitando....
Não sei se isso pode ter a ver com codepage.
É ansi, unicode, UTF-8.... bloco de notas, etc.
Mais uma coisa pra gente ficar de olho....
Parece que copiar blocos de fonte deixou de ser algo tão inofensivo....
Podemos chamar de: o vírus da codepage..... kkkkk
Não sei se isso pode ter a ver com codepage.
É ansi, unicode, UTF-8.... bloco de notas, etc.
Mais uma coisa pra gente ficar de olho....
Parece que copiar blocos de fonte deixou de ser algo tão inofensivo....
Podemos chamar de: o vírus da codepage..... kkkkk
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Esqueci do principal:
Agora compilou tudo normalmente.
Eram mesmo caracteres inválidos no meio do fonte.
Agora compilou tudo normalmente.
Eram mesmo caracteres inválidos no meio do fonte.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Precisei trocar o STATUS por STATUSEX, porque o primeiro não tem divisões.
Já aparece o status, mas chutei a divisão no fonte.... Tá aparecendo coluna 2 vezes... rs
Já aparece o status, mas chutei a divisão no fonte.... Tá aparecendo coluna 2 vezes... rs
Código: Selecionar todos
*----------------------------------------------------------------------------*
* Programa____: VIEWREPORT.PRG *
* Linguagem___: Harbour *
* LIB Gr fica_: HWGUI *
* Programador_: Alexandre Sim es *
* Data________: 2013/08 *
*----------------------------------------------------------------------------*
* Atualiza es: *
*----------------------------------------------------------------------------*
* Fun es_____: ViewReport(cArq) *
* Objetivo____: Visualizar relat rios do tipo texto em janela gr fica gerados*
* pelo harbour. *
*----------------------------------------------------------------------------*
#include "hwgui.ch"
#include "hwg_extctrl.ch"
#define ID_TEXTO 300
#define IDC_STATUS 2001
MEMVAR oDlgReport, n_IniPos, n_FimPos, aBusca, nSizeFont
MEMVAR oButtonList, nPageCurrent, aPageList
MEMVAR cmd1, cmd2, cmd3, cmd4, cmd5, cmd6, cmd7, cmd8, cmd9
FUNCTION Main()
ViewReport( "test.prg" )
RETURN NIL
FUNCTION ViewReport( cFile )
LOCAL oFont, oFont2
LOCAL oDlg_Rel
LOCAL oEdit // , oStatus
LOCAL nWidth := 1920, nHeight := 1080
LOCAL oElement, cButton
PRIVATE oButtonList, nPageCurrent := 1
PRIVATE oDlgReport, n_IniPos := 0, n_FimPos := 0
PRIVATE aBusca := {}
oButtonList := { ;
{ NIL, "-Zoom", "Reduzir", { || ZoomIn_Click( oEdit, oDlgReport ) }, "p:\geral\harbour\zoomin.ico" }, ;
{ NIL, "+Zoom", "Ampliar", { || ZoomOut_Click( oEdit, oDlgReport ) }, "p:\geral\harbour\zoomout.ico" }, ;
{ NIL, "Primeira", "Primeira Página", { || Primeira_Click() }, "p:\geral\harbour\iprimeiro.ico" }, ;
{ NIL, "Anterior", "Página Anterior", { || Anterior_Click() }, "p:\geral\harbour\ianterior.ico" }, ;
{ NIL, "Seguinte", "Página Seguinte", { || Seguinte_Click() }, "p:\geral\harbour\iseguinte.ico" }, ;
{ NIL, "Última", "Última Página", { || Ultima_Click() }, "p:\geral\harbour\iultima.ico" }, ;
{ NIL, "Busca", "Localizar um texto", { || Busca_Click( oEdit ) }, "p:\geral\harbour\ilupa.ico" }, ;
{ NIL, "Imprimir", "Imprimir", { || Imprimir_Click( cFile ) }, "p:\geral\harbour\relatorio.ico" }, ;
{ NIL, "Sair", "Sair", { || Sair_Click() }, "p:\geral\harbour\sair.ico" } }
oDlg_Rel := DlgWait( "Gerando o Relatório", "Aguarde...", "PROCESS32_32.AVI" )
aPageList := FileToArray( cFile )
nSizeFont := -13
PREPARE FONT oFont NAME "Arial" WIDTH 0 HEIGHT 0 WEIGHT -10
oFont2 := HFont():Add( "Courier New" ,0,-13, 0,,, )
hwg_SetToolTipBalloon( .T. )
oDlg_Rel:Close()
INIT DIALOG oDlgReport TITLE "Visualização do Relatório" ;
ICON HICON():AddFile( "p:\geral\harbour\relatorio.ico" ) ;
AT 0, 0 SIZE nWIDTH - 50, nHEIGHT - 50 ;
CLIPPER;
FONT oFont ;
COLOR 15048208 ;
STYLE DS_CENTER + WS_SYSMENU + WS_VISIBLE ;
@ 127, 019 RichEdit oEdit TEXT aPageList[ nPageCurrent ] SIZE nWIDTH - 192, nHEIGHT - 130 ;
OF oDlgReport ID ID_TEXTO ;
COLOR 16711680 ;
BACKCOLOR 15724484 ;
STYLE WS_HSCROLL + WS_VSCROLL + ES_LEFT + ES_MULTILINE + ES_READONLY ;
ON GETFOCUS { || TopoDoc( oEdit ) };
FONT oFont2 ;
ON OTHERMESSAGES { | This, m, wp, lp | richeditProc( this, m,wp, lp ) }
FOR EACH oElement IN oButtonList
cButton := "cmd" + Ltrim( Str( oElement:__EnumIndex ) )
@ 006, 020 + ( ( oElement:__EnumIndex - 1 ) * 50 ) BUTTONEX &cButton ;
CAPTION oElement[ 2 ] ;
ON CLICK oElement[ 4 ] ;
SIZE 115, 40 ;
ICON HICON():AddFile( oElement[ 5 ] ) ;
TOOLTIP oElement[ 3 ]
NEXT
ADD STATUSEX oStatus TO oDlgReport PARTS 100,100,100,180,0 ON INIT { | oStatus | Status( oStatus ) }
oDlgReport:Activate() // Par metro .T. = NOMODAL, .F. ou () = MODAL
RETURN NIL
STATIC FUNCTION ZoomIn_Click( oEdit, oDlgReport )
ZoomRep( oEdit, "-", oDlgReport )
RETURN NIL
STATIC FUNCTION ZoomOut_Click( oEdit, oDlgReport )
ZoomRep( oEdit, "+", oDlgReport )
RETURN NIL
STATIC FUNCTION Primeira_click()
nPageCurrent := 1
ReloadPage()
RETURN NIL
STATIC FUNCTION Anterior_Click()
nPageCurrent := Max( 1, nPageCurrent - 1 )
ReloadPage()
RETURN NIL
STATIC FUNCTION Seguinte_Click()
nPageCurrent := Min( nPageCurrent + 1, Len( aPageList ) )
ReloadPage()
RETURN NIL
STATIC FUNCTION Ultima_Click()
nPageCurrent := Len( aPageList )
ReloadPage()
RETURN NIL
STATIC FUNCTION Imprimir_Click( cFile )
ImprimeRaw( cFile )
RETURN NIL
STATIC FUNCTION Sair_Click()
hwg_EndDialog()
RETURN NIL
STATIC FUNCTION FileToArray( cFile )
LOCAL cLinha, lEject, aPageList := {}, cPage := ""
FT_FUSE( cFile )
DO WHILE ! FT_FEOF()
cLinha := FT_FREADLN()
lEject := ( Chr(12) $ cLinha )
//lEscape := ( Chr(27) $ cLinha )
cLinha := StrTran( cLinha, Chr( 12 ) ) // Elimina caracter EJECT
cLinha := Reformata( cLinha )
IF FT_FRECNO() = 1
IF Empty( cLinha ) //.AND. lEscape
FT_FSKIP()
LOOP
ENDIF
ENDIF
cPage += cLinha + Chr( 13 ) + Chr( 10 )
IF lEject
AADD( aPageList, cPage )
cPage := ""
ENDIF
FT_FSKIP()
ENDDO
FT_FUSE()
IF ! Empty( cPage )
AAdd( aPageList, cPage )
ENDIF
IF Len( aPageList ) == 0
AAdd( aPageList, "" )
ENDIF
RETURN aPageList
STATIC FUNCTION ReloadPage()
LOCAL oDlg := hwg_GetModalHandle()
hwg_SetDlgItemText( oDlg, ID_TEXTO, HB_OEMTOANSI( aPageList[ nPageCurrent ] ) )
hwg_WriteStatus( oDlgReport, 5, "Página: " + Ltrim( Str( nPageCurrent, 6 ) ) + " de " + Ltrim( Str( Len( aPageList ), 6 ) ) )
RETURN NIL
STATIC FUNCTION ImprimeRaw( cArqImp )
LOCAL cPrinter := WIN_PrinterGetDefault(), oDlg_Rel
IF ! hwg_MsgYesNo( "Confirma a impress o?", "Aten o" )
RETURN NIL
ENDIF
oDlg_Rel := DlgWait( "Imprimindo o Relatório", "Aguarde...", "P:\GERAL\HARBOUR\IMPRESSORA.AVI" )
WIN_PrintFileRaw( cPrinter, cArqImp, 'REPORT_PREVIEW' )
oDlg_Rel:Close()
RETURN Nil
STATIC FUNCTION FocoRichEdit( oEdit )
oEdit:SetFocus()
hwg_SendMessage( oEdit:handle, EM_SETSEL, n_IniPos, n_FimPos )
RETURN NIL
STATIC FUNCTION Busca_Click( oEdit )
LOCAL cBusca
LOCAL nStartFind := 0
LOCAL lCase := .F.
LOCAL nPos
LOCAL nPageFound := 0
LOCAL oElement
//LOCAL cRes
cBusca := MsgGet( "Pesquisa de Texto","Informe o que deseja encontrar:" )
FOR EACH oElement IN aPageList
IF Upper( cBusca ) $ Upper( oElement )
nPageFound := oElement:__EnumIndex
EXIT
ENDIF
hwg_doevents()
NEXT
IF nPageFound == 0
IF ! Empty( cBusca )
hwg_MsgInfo( 'Não foi possível encontrar o texto: ' + cBusca + '.', 'Atenção' )
ENDIF
RETURN .T.
ENDIF
nPageCurrent := nPageFound
ReloadPage()
//nPos := hwg_RE_FindText( oEdit:handle, cBusca, nStartFind, lCase )
oEdit:SetColor( 16711680 )
DO WHILE ( nPos := hwg_RE_FindText( oEdit:handle, cBusca, nStartFind, lCase ) ) > 0
n_IniPos := nPos
n_FimPos := nPos + Len( cBusca )
oEdit:SetFocus()
hwg_SendMessage( oEdit:handle, EM_SETSEL, n_IniPos, n_FimPos )
hwg_re_SetCharFormat( oEdit:handle, { { n_IniPos + 1, n_FimPos + 1,,,, .T. }, { n_IniPos + 1, n_FimPos + 1, 255,,, .T.,, .F. } } )
hwg_SendMessage(oEdit:handle, EM_SETSEL, -1, 0 )
nStartFind := nPos + Len( cBusca ) + 1
ENDDO
RETURN .T.
STATIC FUNCTION Reformata( cTexto )
LOCAL cText := cTexto
cText := StrTran( cText, Chr(27) + "P" + Chr(15) )
cText := StrTran( cText, Chr(12), Chr(13) + Chr(13) )
cText := StrTran( cText, Chr(27) + "P" )
cText := StrTran( cText, Chr(27) + Chr(77) + Chr(15) )
cText := StrTran( cText, Chr(27) + Chr(77) + Chr(18) )
cText := StrTran( cText, Chr(27) + Chr(80) + Chr(18) )
cText := StrTran( cText, Chr(15) )
cText := StrTran( cText, Chr(18) )
cText := StrTran( cText, " %0A (s0p15h0s0b4102T" )
cText := StrTran( cText, " %0A (s0p10h0s0b4099T" )
RETURN cText
STATIC FUNCTION Status( oControl )
oControl:settext( "Lin:" + Str( 1, 6 ), 3 )
oControl:settext( "Col:" + Str( 1, 6 ), 4 )
oControl:settext( "Página: " + LTrim( Str( 1, 6 ) ) + " de " + LTrim( Str( Len( aPageList ), 6 ) ), 5 )
RETURN NIL
STATIC FUNCTION TopoDoc( oEdit )
hwg_SendMessage( oEdit:Handle, WM_VSCROLL ,SB_TOP, 0 )
hwg_SendMessage( oEdit:Handle, EM_SETSEL , 0, 0 )
RETURN .T.
STATIC FUNCTION ZoomRep( oEdit, cSize, oDlgReport )
LOCAL oFont2
IF cSize = '+'
hwg_WriteStatus( oDlgReport, 1, "+ Zoom" )
ELSE
hwg_WriteStatus( oDlgReport, 1, "" )
ENDIF
nSizeFont += nSizeFont + IIF( cSize = '+', 1, -1 )
nSizeFont := IIF( cSize = '+', Min( -9, nSizeFont ), Max( -13, nSizeFont ) )
oFont2 := HFont():Add( "Courier New", 0, nSizeFont )
hwg_SendMessage( oEdit:Handle, WM_SETFONT, oFont2:handle, 0 )
oEdit:SetColor( 16711680 )
oEdit:Refresh()
RETURN .T.
STATIC FUNCTION RichEditProc( oEdit, Msg, wParam, lParam )
LOCAL nLinha, nColuna
IF Msg == WM_KEYUP .OR. Msg == WM_KEYDOWN .OR. Msg == WM_LBUTTONDOWN .OR. Msg == WM_SYSKEYDOWN
nColuna := hwg_Loword( hwg_SendMessage( oEdit:Handle, EM_GETSEL, 0, 0 ) )
nLinha := hwg_SendMessage( oEdit:Handle, EM_LINEFROMCHAR, nColuna, 0 ) + 1
nColuna := nColuna - hwg_SendMessage( oEdit:Handle, EM_LINEINDEX, -1, 0 ) + 1
//
hwg_WriteStatus( oDlgReport, 2, 'Lin:' + Str( nLinha, 6 ) )
hwg_WriteStatus( oDlgReport, 3, 'Col:' + Str( nColuna, 6 ) )
oEdit:Refresh()
ENDIF
HB_SYMBOL_UNUSED( wParam + lParam )
RETURN -1
STATIC FUNCTION MsgGet( cTitle, cText, nStyle, x, y, nDlgStyle, cResIni )
LOCAL oModDlg, oFont := HFont():Add( "MS Sans Serif", 0, - 13 )
LOCAL cRes := IIf( cResIni != Nil, Trim( cResIni ), "" )
LOCAL oIconOk := HIcon():AddFile( "P:\GERAL\HARBOUR\IOK.ICO" )
LOCAL oIconCancela := HIcon():AddFile( "P:\GERAL\HARBOUR\ICANCELA.ICO" )
hb_Default( @nStyle, 0 )
hb_Default( @x, 210 )
hb_Default( @y, 10 )
hb_Default( @nDlgStyle, 0 )
INIT DIALOG oModDlg TITLE cTitle At x, y SIZE 300, 140 ;
FONT oFont CLIPPER ;
STYLE DS_CENTER+ WS_POPUP + WS_VISIBLE + WS_CAPTION + WS_SYSMENU + WS_SIZEBOX + nDlgStyle
@ 20, 10 SAY cText SIZE 260, 22
@ 20, 35 GET cRes SIZE 260, 26 STYLE WS_TABSTOP + ES_AUTOHSCROLL + nStyle
oModDlg:aControls[ 2 ]:Anchor := ANCHOR_TOPABS + ANCHOR_LEFTABS + ANCHOR_RIGHTABS
@ 20, 95 BUTTONEX "Ok" ID IDOK SIZE 115, 40 ICON oIconOk:handle TOOLTIP 'Clique aqui para iniciar a pesquisar.'
oModDlg:aControls[ 3 ]:Anchor := ANCHOR_BOTTOMABS
@ 168,95 BUTTONEX "Cancelar" ID IDCANCEL SIZE 115, 40 ICON oIconCancela:handle TOOLTIP 'Clique aqui para cancelar a pesquisa.'
oModDlg:aControls[ 4 ]:Anchor := ANCHOR_RIGHTABS + ANCHOR_BOTTOMABS
ACTIVATE DIALOG oModDlg ON ACTIVATE { || IIF( ! Empty( cRes ), HWG_KEYB_EVENT( VK_END ), .T. ) }
oFont:Release()
IF oModDlg:lResult
RETURN Trim( cRes )
ELSE
cRes := ""
ENDIF
RETURN cRes
STATIC FUNCTION DlgWait( cTitle, cMensagem_Wait, cArqVideo )
LOCAL oDlg_Wait, oLabel_Wait
LOCAL oIconWait := HIcon():AddFile( "P:\GERAL\HARBOUR\IAMPULHETA.ICO" )
/* LOCAL lAutoPlay := .T., lCenter:=.T., lTransparent := .T. */
hb_Default( @cArqVideo, "P:\GERAL\HARBOUR\LOADER.AVI" )
/* cRes := "" */
INIT DIALOG oDlg_Wait TITLE cTitle ;
ICON oIconWait ;
AT 0, 0 ;
SIZE 350, 90 STYLE DS_CENTER + WS_SYSMENU //90
@ 10,10 ANIMATION SIZE 30, 30 AUTOPLAY CENTER TRANSPARENT FILE cArqVideo
@ 50, 20 SAY oLabel_Wait CAPTION cMensagem_Wait SIZE 200, 19
ACTIVATE DIALOG oDlg_wait NOMODAL
RETURN oDlg_Wait
FUNCTION AberturaAvi( cArqVideo, cTitle )
LOCAL oDlg_Wait /*, oCtrl, oWait */
LOCAL lAutoPlay := .T., lCenter := .T., lTransparent := .F.
hb_Default( @cArqVideo, "" )
hb_Default( @cTitle, "" )
INIT DIALOG oDlg_Wait TITLE cTitle ;
AT 0, 0 ;
CLIPPER;
SIZE 737, 518 STYLE DS_CENTER + WS_VISIBLE
/* oCtrl := */ HAnimation():New( oDlg_Wait, , , 5, 5, 720, 480, cArqVideo, lAutoPlay, lCenter, lTransparent )
oDlg_Wait:Activate()
RETURN oDlg_Wait
PROCEDURE Fim( oControl1,oControl2 )
oControl2:End()
oControl1:Close()
oControl1:Destroy()
hwg_EndDialog()
RETURN
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Função para localizar um texto em um richedit
Uso em meus fontes e funciona:
Código: Selecionar todos
aDd STATUS oStatus TO oDlgPDV PARTS 160, 130, 100, 067, 115, 100, 090, 062, 085, 160 ;
ON INIT {|this| this:SETtextPanel(1, "Controle Nr. " + AllTrim(Trans( vUltimoPedido, "@E 99,999,999" )) ),;
this:SETtextPanel(2, senha->NOMUSU ),;
this:SETtextPanel(3, "Nr. Itens " + StrZero(vSEQITM,3) ),;
this:SETtextPanel(4, time() ),;
this:SETtextPanel(5, bCOMPUTADOR ),;
this:SETtextPanel(6, IpEstacao ),;
this:SETtextPanel(7, "Versao " + AllTrim(cVersao) ) ,;
this:SETtextPanel(8, "ACBr ." + If( Acbr='1',Trans(.T., nil),Trans(.F., nil) ) + "." ),;
this:SETtextPanel(9, oMarcaECF ),;
this:SETtextPanel(10, oNumSerie ) };
Font HFont():Add( 'Arial',0,-13,700,,,)
fui...
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Até olhei de novo pra conferir....
Tinha olhado o HStatus da GTK, este não tem:
Tem o HStatus normal Windows, mas é SetText() não SetTextPanel()
O que ainda não resolvi é sobre os ícones. Ainda não apareceram, nem com hIcon():AddFile(), nem com hIcon():AddResource(), nem criando variável primeiro.
E sim... confirmei os ícones em disco e resource, conforme o caso.
Também adicionei o manifest pra ver se o problema era esse, e até testei somente ícone sem texto, mas nenhum fez aparecer o ícone.
Já o ícone do formulário/aplicativo aparece normalmente, nas duas opções.
Tinha olhado o HStatus da GTK, este não tem:
Código: Selecionar todos
CLASS HStatus INHERIT HControl
CLASS VAR winclass INIT "msctls_statusbar32"
DATA aParts
METHOD New( oWndParent, nId, nStyle, oFont, aParts, bInit, bSize, bPaint )
METHOD Activate()
METHOD Init()
METHOD SetText( t ) INLINE hwg_WriteStatus( ::oParent,, t )
ENDCLASS
Tem o HStatus normal Windows, mas é SetText() não SetTextPanel()
Código: Selecionar todos
CLASS HStatus INHERIT HControl
CLASS VAR winclass INIT "msctls_statusbar32"
DATA aParts
METHOD New( oWndParent, nId, nStyle, oFont, aParts, bInit, bSize, bPaint )
METHOD Activate()
METHOD Init()
METHOD Redefine( oWndParent,nId,cCaption,oFont,bInit, ;
bSize,bPaint,ctooltip,tcolor,bcolor,lTransp,aParts )
METHOD SetText( cText,nPart ) INLINE hwg_WriteStatus( ::oParent, nPart, cText )
ENDCLASS
E sim... confirmei os ícones em disco e resource, conforme o caso.
Também adicionei o manifest pra ver se o problema era esse, e até testei somente ícone sem texto, mas nenhum fez aparecer o ícone.
Já o ícone do formulário/aplicativo aparece normalmente, nas duas opções.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Função para localizar um texto em um richedit
Minha versao, 2.17 (by Basso hehehe), tem:
Código: Selecionar todos
// - HStatus
CLASS HStatus INHERIT HControl
CLASS VAR winclass INIT "msctls_statusbar32"
DATA aParts
DATA nStatusHeight INIT 0
DATA bDblClick
DATA bRClick
METHOD New( oWndParent, nId, nStyle, oFont, aParts, bInit, bSize, bPaint, bRClick, bDblClick, nHeight )
METHOD Activate()
METHOD Init()
METHOD Notify( lParam )
METHOD Redefine( oWndParent, nId, cCaption, oFont, bInit, ;
bSize, bPaint, ctooltip, tcolor, bcolor, lTransp, aParts )
METHOD SetTextPanel( nPart, cText, lRedraw )
METHOD GetTextPanel( nPart )
METHOD SetIconPanel( nPart, cIcon, nWidth, nHeight )
METHOD StatusHeight( nHeight )
METHOD Resize( xIncrSize )
ENDCLASS
fui...
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
O fonte não formatado me confundiu. a status ex é igual essa.
O CLASS VAR pareceu classe nova.
O CLASS VAR pareceu classe nova.
Código: Selecionar todos
CLASS HStatusEx INHERIT HControl
CLASS VAR winclass INIT "msctls_statusbar32"
DATA aParts
DATA nStatusHeight INIT 0
DATA bDblClick
DATA bRClick
METHOD New( oWndParent, nId, nStyle, oFont, aParts, bInit, bSize, bPaint, bRClick, bDblClick, nHeight )
METHOD Activate()
METHOD Init()
METHOD Notify( lParam )
METHOD Redefine( oWndParent, nId, cCaption, oFont, bInit, ;
bSize, bPaint, ctooltip, tcolor, bcolor, lTransp, aParts )
METHOD SetText( cText,nPart ) INLINE hwg_WriteStatus( ::oParent, nPart, cText )
METHOD SetTextPanel( nPart, cText, lRedraw )
METHOD GetTextPanel( nPart )
METHOD SetIconPanel( nPart, cIcon, nWidth, nHeight )
METHOD StatusHeight( nHeight )
METHOD Resize( xIncrSize )
ENDCLASS
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
-
gilbertosilverio
- Usuário Nível 3

- Mensagens: 339
- Registrado em: 18 Jan 2009 10:39
- Localização: Ribeirao Pires - SP
Função para localizar um texto em um richedit
Jose Quintas,
Baseado nos teus achados:
1) Declara as variáveis na linha 42
PRIVATE aBusca := {}, this, atexto:=""
2) Como foi retirado a SETTEXTPANEL, eu alterei para SETTEXT e funcionou
STATIC FUNCTION Status( This, aTexto )
This:settext( oDlgReport, 2, 'Lin:' + Str( 1, 6 ) )
This:settext( oDlgReport, 3, 'Col:' + Str( 1, 6 ) )
This:settext( oDlgReport, 4, 'Página: ' + LTrim( Str( 1, 6 ) ) + " de " + LTrim( Str( Len( aTexto ), 6 ) ) )
RETURN NIL
O unico detalhe, o numero de pagina não esta saindo quando e criado a primeira visualização...
Baseado nos teus achados:
1) Declara as variáveis na linha 42
PRIVATE aBusca := {}, this, atexto:=""
2) Como foi retirado a SETTEXTPANEL, eu alterei para SETTEXT e funcionou
STATIC FUNCTION Status( This, aTexto )
This:settext( oDlgReport, 2, 'Lin:' + Str( 1, 6 ) )
This:settext( oDlgReport, 3, 'Col:' + Str( 1, 6 ) )
This:settext( oDlgReport, 4, 'Página: ' + LTrim( Str( 1, 6 ) ) + " de " + LTrim( Str( Len( aTexto ), 6 ) ) )
RETURN NIL
O unico detalhe, o numero de pagina não esta saindo quando e criado a primeira visualização...
GilbertoSilverio
gilbertosilverio@gmail.com
gilbertosilverio2003@yahoo.com.br
gilbertosilverio@gmail.com
gilbertosilverio2003@yahoo.com.br
Função para localizar um texto em um richedit
Olá Bom dia a todos,
Janio, eu até procurei no google como fazer um "hilighting" da linha, achei alguns exemplos mas não consegui produzi-los, veja que a richedit é um editor de textos semelhante ao word da ms, no word não tem esse destaque de linha, talvez outro objeto resolva como listbox ou browse de array, tem que pesquisar
Janio, eu até procurei no google como fazer um "hilighting" da linha, achei alguns exemplos mas não consegui produzi-los, veja que a richedit é um editor de textos semelhante ao word da ms, no word não tem esse destaque de linha, talvez outro objeto resolva como listbox ou browse de array, tem que pesquisar
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Ainda falta descobrir porque não aparecem os ícones nos botões.
As opções email e página específica apenas acrescentei botões, pelo menos email é melhor deixar de fora do fonte, porque cada um tem sua própria solução, em hb32, hb34, xhb ou componente externo.
https://github.com/JoseQuintas/AllGui/b ... w/test.prg
Ainda dá pra melhorar FileToArray(), fazendo uso de RegExSplit(), e dá pra melhorar outras coisas mais.
Não está no "padrão Harbour" de fontes, mas acho que melhorou bastante.
Nem é questão de usar recursos avançados, classes, etc, trata-se de simplificar/organizar fonte pra ficar mais fácil de mexer depois.
O PRG tem quase a mesma quantidade de linhas que antes, mas usadas pra organizar.
É sempre bom fazer algo assim, antes de adotar um fonte como modelo.
Lembrando:
Eu não conseguiria fazer esse fonte do zero, eu apenas procurei organizar/simplificar pensando em como o Harbour funciona.
O resultado é interessante, comparem
Aproveitar pra lembrar o que comentei num post antigo: primeiro organizar fontes antes de adicionar recursos/parte GUI.
Se o fonte tá complicado, adicionar recursos vai ser mais complicado ainda... rs
As opções email e página específica apenas acrescentei botões, pelo menos email é melhor deixar de fora do fonte, porque cada um tem sua própria solução, em hb32, hb34, xhb ou componente externo.
https://github.com/JoseQuintas/AllGui/b ... w/test.prg
Ainda dá pra melhorar FileToArray(), fazendo uso de RegExSplit(), e dá pra melhorar outras coisas mais.
Não está no "padrão Harbour" de fontes, mas acho que melhorou bastante.
Nem é questão de usar recursos avançados, classes, etc, trata-se de simplificar/organizar fonte pra ficar mais fácil de mexer depois.
O PRG tem quase a mesma quantidade de linhas que antes, mas usadas pra organizar.
É sempre bom fazer algo assim, antes de adotar um fonte como modelo.
Lembrando:
Eu não conseguiria fazer esse fonte do zero, eu apenas procurei organizar/simplificar pensando em como o Harbour funciona.
O resultado é interessante, comparem
Aproveitar pra lembrar o que comentei num post antigo: primeiro organizar fontes antes de adicionar recursos/parte GUI.
Se o fonte tá complicado, adicionar recursos vai ser mais complicado ainda... rs
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Comentário adicional:
Conforme a gente vai simplificando, a gente vai encontrando mais lugares pra simplificar.
Por exemplo, eliminar estas duas funções:
Conforme a gente vai simplificando, a gente vai encontrando mais lugares pra simplificar.
Por exemplo, eliminar estas duas funções:
Código: Selecionar todos
STATIC FUNCTION Imprimir_Click( cFile )
ImprimeRaw( cFile )
RETURN NIL
STATIC FUNCTION Sair_Click()
hwg_EndDialog()
RETURN NIL
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Função para localizar um texto em um richedit
Quintas, ja tentou embutir as imagens num recource? Eu uso da maneira abaixo e funciona tanto para .bmp, quanto para .icoAinda falta descobrir porque não aparecem os ícones nos botões.
Código: Selecionar todos
@ 182,089 BUTTONEX oButtonex2 CAPTION "&Salvar Lançamento" SIZE 156,32 ;
BITMAP (HBitmap():AddResource('save')):handle ;
STYLE BS_CENTER + WS_TABSTOP ;
ON CLICK {|| SalvaItensCupomDav() } ;
@ 352,089 BUTTONEX oButtonex3 CAPTION "&Retornar" SIZE 156,32 ;
ICON (HIcon():AddResource('ExitIco')):handle ;
STYLE BS_CENTER +WS_TABSTOP ;
ON CLICK {|| EndDialog(), lRetornaCancCupom := .f. } ;
fui...
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Função para localizar um texto em um richedit
Tentei, com ícone hicon(). Dá erro de que Handle não faz parte da classe hicon.
Não sei se exige ícone em um tamanho especifico.
Não sei se exige ícone em um tamanho especifico.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
