Clipper On Line • Ver Tópico - Função para localizar um texto em um richedit

Função para localizar um texto em um richedit

Projeto HwGui - Biblioteca visual para Harbour/xHarbour

Moderador: Moderadores

 

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 11:35

Aliás... não dá pra simplificar isso?
Tem horas que acho muito fonte pra pouca coisa, mas não sei se isso faz parte do fonte, ou do projeto hwgui.
Comparando com um trecho de fonte do VB6, de um preview que fiz há muito tempo:

Private Sub cmdMaisZoom_Click()
   TextPreview.FontSize = Min(30, TextPreview.FontSize + 1)
End Sub

Private Sub cmdMenosZoom_Click()
   TextPreview.FontSize = Max(5, TextPreview.FontSize - 1)
End Sub


Vamos ver o que conseguimos fazer no fonte novo....
Vai parecer repetitivo, mas ... vamos ver se dá pra fazer igual na GTWVG... rs
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor janio » 17 Abr 2017 12:56

aSimoes,

Achei sua função complexa de mais pra minha pobre cabecinha hehe. Mas pergunto:

Teria como colocar no seu Preview uma BARRA LUMINOSA, tipo nos browse, pra ficar melhor a visualização de onde está o cursor??

Janio
fui...
e-mail:janioaguiar@yahoo.com.br
msn: janio_aguiar@hotmail.com
xHarbour1.2.1/Harbour3.2 + wvg + hwgui + Mediator + MySql
Avatar de usuário

janio
Colaborador

Colaborador
 
Mensagens: 1835
Data de registro: 06 Jul 2004 07:43
Cidade/Estado: UBAJARA - CE
Curtiu: 8 vezes
Mens.Curtidas: 68 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 13:10

Primeiro teste de redução. Deu certo, apesar de precisar macro e "jogar fora" o nome do botão, que não é usado pra nada.
Montagem dos botões:

   oButtonList := { ;
      { NIL, "-Zoom",     "Reduzir",            { || ZoomIn_Click() },   "p:\geral\harbour\zoomin.ico" }, ;
      { NIL, "+Zoom",     "Ampliar",            { || ZoomOut_Click() },  "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, "Ultima",    "Última Página",      { || Ultima_Click() },   "p:\geral\harbour\iultima.ico" }, ;
      { NIL, "Busca",     "Localizar um texto", { || Busca_Click() },    "p:\geral\harbour\ilupa.ico" }, ;
      { NIL, "Imprimir",  "Imprimir",           { || Imprimir_Click() }, "p:\geral\harbour\relatorio.ico" }, ;
      { NIL, "Sair",      "Sair",               { || Sair_Click() },     "p:\geral\harbour\sair.ico" } }

   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  oElement[ 5 ] ;
      TOOLTIP oElement[ 3 ]
   NEXT
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 13:20

Achei sua função complexa de mais pra minha pobre cabecinha hehe


Acho que depois das alterações vai ficar fácil... rs

Quanto à linha em destaque... só se o ASimões ou alguém souber...
Sou principiante em qualquer GUI. Só estou pegando exemplo pronto e modificando baseado no funcionamento do Harbour, pra ver se a GUI aceita.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 14:35

Mais uma parte:
O array já tem todas as páginas, então... basta controlar a posição atual dentro do array.

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


Dá até pra pensar em mais uma opção: ir direto pra uma determinada página. nPageCurrent := x
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 15:27

Depois das alterações:

*----------------------------------------------------------------------------*
* 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, "Ultima",    "Ú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

   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, 4, "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( This, aTexto )

   This:settextpanel( 2, 'Lin:' + Str( 1, 6 ) )
   This:settextpanel( 3, 'Col:' + Str( 1, 6 ) )
   This:settextpanel( 4, 'Página: ' + LTrim( Str( 1, 6 ) ) + " de " + LTrim( Str( Len( aTexto ), 6 ) ) )

   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" )

   nStyle := IIf( nStyle == Nil, 0, nStyle )
   x := IIf( x == NIL, 210, x )
   y := IIf( y == NIL, 10, y )
   nDlgStyle := IIf( nDlgStyle == NIL, 0, nDlgStyle )

   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


A propósito... a idéia inicial era salvar os botões no próprio array, mas a hwgui não aceitou usar array, acabou ficando o primeiro elemento com NIL.
Seria eliminar esse primeiro elemento, e alterar o for/next pra retirada dele. Deixei até pra mostrar que foi a primeira tentativa que fiz.

      { NIL, "-Zoom",     "Reduzir",            { || ZoomIn_Click( oEdit, oDlgReport ) },   "p:\geral\harbour\zoomin.ico" }, ;


Apliquei o que uso na GTWVG pra botões, e um pouco do que seria no VB6, rotina pra evento Click() enxuta.
A gente sempre acha idéias interessantes em fontes pra aproveitar.... rs

E uma coisa interessante pra quem não percebeu: entrou mais código Harbour (ou não), e reduziu código HWGUI.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor gilbertosilverio » 17 Abr 2017 16:12

Boa tarde Jose Quintas,

Este teu exemplo, você compilou com a HWGUI+MSVC+HB34 pelo que verifiquei no allgui, correto?

Tentei compilar este exemplo com HWGUI+MINGW6.3+HB34, mais não funciona, da erro no hanimation.

So me tira esta duvida por favor.

Creio que a Hwgui compilada com makemngw da alguns erros em determinadas classes...

Grato.
gilbertosilverio
Usuário Nível 3

Usuário Nível 3
 
Mensagens: 332
Data de registro: 18 Jan 2009 09:39
Cidade/Estado: Ribeirao Pires - SP
Curtiu: 1 vez
Mens.Curtidas: 23 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 16:26

"Meu exemplo" não é meu, é do ASimões, ele usa HWGUI 2.17

Esse último eu compilei com HWGUI 2.20, acabei comentando uma parte de animation que não aceitou, por considerar diferença de versão.
Também não teria avi pra fazer algum teste.

Como eu disse, ainda não mexo com hwgui e nenhuma gui, apenas estou usando o que conheço de Harbour pra ajustar alguma coisa em fontes prontos.
E testes com a allgui também... com o tempo vou aprendendo a mexer... rs

Aqui posso usar msvc 2010 ou mingw pra hwgui. Só a parte de activex é que não compilou com msvc 2010.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 16:31

Esta a parte que não compilou e comentei.

   // @ 10,10 ANIMATION SIZE 30, 30 AUTOPLAY CENTER TRANSPARENT FILE cArqVideo


E também uma parte do status.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 16:44

A outra do status:

status.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor gilbertosilverio » 17 Abr 2017 16:55

Não queres assumir a paternidade... kkkkk

Comentei também a linha HAnimation():New( oDlg_Wait, , , 5, 5, 720, 480, cArqVideo, lAutoPlay, lCenter, lTransparent ), ai passou...

Como tenho muitas rotinas que usam a HAnimation, não consigo migrar para a hwgui 2.20 ainda...

Grato.
gilbertosilverio
Usuário Nível 3

Usuário Nível 3
 
Mensagens: 332
Data de registro: 18 Jan 2009 09:39
Cidade/Estado: Ribeirao Pires - SP
Curtiu: 1 vez
Mens.Curtidas: 23 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 16:57

Vixi... aqui só com ajuda dos universitários.... rs

o fonte, o CH, e o PPO

hwguistatus.png


Fiz o teste somente usando a pasta include da hwgui e o resultado foi o mesmo.
Alguém tem alguma sugestão?
O erro é aquele último que postei.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 17:26

Agora um teste totalmente isolado:

#xcommand ADD STATUS [<oStat>] [ TO <oWnd> ] ;
            [ ID <nId> ]           ;
            [ ON INIT <bInit> ]    ;
            [ ON SIZE <bSize> ]    ;
            [ ON PAINT <bDraw> ]   ;
            [ STYLE <nStyle> ]     ;
            [ FONT <oFont> ]       ;
            [ PARTS <aparts,...> ] ;
          => ;
          [ <oStat> := ] HStatus():New( <oWnd>,<nId>,<nStyle>,<oFont>,\{<aparts>\},<bInit>,;
             <bSize>,<bDraw> );
             [; hwg_SetCtrlName( <oStat>,<(oStat)> )]

PROCEDURE Main

   ADD STATUS oStatus TO oDlgReport PARTS 100,100,100,180,0 ON INIT { | This | Status( This, aTexto ) }   



Compiling 'test.prg'...

test.prg:16: error E0030 Syntax error "syntax error at 'á'"
1 error


ppo


PROCEDURE Main

   oStatus :=   :=   := HStatus():New( oDlgReport,,,,{100,100,100,180,0},{ | This | Status( This, aTexto ) },, ) ; hwg_SetCtrlName( oStatus,"oStatus" ) ; hwg_SetCtrlName(  ," " ) ; hwg_SetCtrlName(  ," " )


Alguém pode compilar este fonte acima, desta mensagem, pra ver se passa na compilação?
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 17:38

Baixei o Harbour 3.2 nightly pra testar compilar, e a coisa piorou.... rs
É só aquele fonte com uma linha de #xcommand e outra de fonte.

d:\temp>hbmk2 test
hbmk2: Processing environment options: -comp=msvc
Harbour 3.2.0dev (r1704151935)
Copyright (c) 1999-2016, http://harbour-project.org/
Compiling 'test.prg'...
test.prg(16) Error E0030 Syntax error "syntax error at 'á'"
1 error

No code generated.

Unrecoverable error 9000: hb_compExprDealloc() called with an invalid pointer
Called from HB_COMPILE(0)
Called from HBMK_HB_COMPILE(0) in ../../../hbmk2.prg
Called from __HBMK(0) in ../../../hbmk2.prg
Called from HBMK_LOCAL_ENTRY(0) in ../../../hbmk2.prg
Called from _APPMAIN(0) in ../../../hbmk2.prg
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Função para localizar um texto em um richedit

Mensagempor JoséQuintas » 17 Abr 2017 18:07

O problema parece ser o fonte mesmo. kkkkk

Tirando os caracteres conhecidos ainda sobra.
Agora não sei se veio do fonte original, ou se passear o fonte pela internet causou modificações.

testhwgui.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18008
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Anterior Próximo



Retornar para HwGui

Quem está online

Usuários vendo este fórum: Nenhum usuário registrado online e 6 visitantes


Ola Amigo, espero que meu site e forum tem lhe beneficiado, com exemplos e dicas de programacao.
Entao divulgue o link da Doacao abaixo para seus amigos e redes sociais ou faça uma doacao para o site forum...
MUITO OBRIGADO PELA SUA DOACAO!
Faça uma doação para o forum
cron
v
Olá visitante, seja bem-vindo ao Fórum Clipper On Line!
Efetue o seu login ou faça o seu Registro