Ayuda con RTF

Ayuda con RTF

Postby remtec » Mon Jul 25, 2022 6:14 pm

Amigos, buen dia.

Tengo una funcion funcionando OK con RTF en DIALOGO, pero quiero hacer el dialogo con coordenadas.

Esta funcion usa TRichEdit5(), lo que hace es permitir que se actualice un codigo con colores y tipos de letras, y los guardo en un campo MEMO, solo que ahora lo quiero hacer con coordenadas la ctualizacion.

Como podria modificar el codigo.

Saludos
Antonio

Codigo Funcionando:
Code: Select all  Expand view

function Act_eco1(Folio1,aProfe)

   local oDlg
   local oRich

   local lSyntaxHL := .f.
   local cTxt      := ""
     Local oFont1,oFont2,oSay1,oSay2,oSay3,oSay4

        Abre_dbf("TipExa",1,.f.,"")
    Set inde to TipExa
        Go top
         if eof()
         MsgStop(" ARCHIVO TIPOS DE EXAMENES VACIO")
             Dbclosearea()
             Return .f.
     endif

   // Simulo la lectura del contenido del campo
   //cTxt  :=  "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Microsoft Sans Serif;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}" + ;
   //          "{\colortbl ;\red128\green0\blue0;\red0\green0\blue0;\red0\green128\blue0;\red255\green0\blue0;}" + ;
   //          "\viewkind4\uc1\pard\cf1\b\i\f0\fs28 JH\cf2\b0\i0  - Sue let me \cf3 know\cf2  that their rep had noticed that they were not performing the yearly \cf4\ul\b\fs24 escrow\cf2\ulnone\b0\fs28  analysis.\cf0\f1\fs17\par" + ;
   //          "}"
     if eof()

                 cTxt =  ""
     Else
                 cTxt:=a->Det_Exa
        endif
        Define Font oFont1 Name "Curier New" Size 0,16  BOLD
      Define Font oFont2 Name "Curier New" Size 0,18  BOLD

        Define Font oFont  Name "Courier new" Size 0,22   BOLD

     DEFINE DIALOG oDlg RESOURCE "#1011"     Title  "ACTUALIZA INFORME"
   oDlg:lHelpIcon   := .F.

     /*
     REDEFINE COMBOBOX oCod_pro1 VAR nCod_pro1 ITEMS ArrTranspose(aProfe)[2] ID 107 OF oDlg COLORS nRGB(9, 11, 10), nRGB(73, 250, 202);
                        ON CHANGE (cCod_pro1:=ArrTranspose(aProfe)[1][oCod_pro1:nAt])
     */


   oRich := TRichEdit5():Redefine( 4001, bSETGET( cTxt ), oDlg )

     REDEFINE BTNBMP ID 153 Resource "GRABA" OF oDlg TOOLTIP "Graba Informe"  TRANSPARENT ADJUST 2007;
                        ACTION (cTxt := oRich:SaveAsRTF(),Graba(cTxt))

    // REDEFINE BTNBMP ID 4012 Resource "#8034" OF oDlg TOOLTIP "Imprime Informe"  TRANSPARENT ADJUST 2007;
  //                         ACTION (MsgInfo( cTxt ))

     REDEFINE BTNBMP ID 152 Resource "#8004" OF oDlg TOOLTIP "Volver a Lista de Pacientes" TRANSPARENT ADJUST 2007;
                         ACTION (oDlg:END())


   ACTIVATE DIALOG oDlg CENTERED ;  //
      ON INIT ( oRich:LoadRtf( cTxt ), oRich:PostMsg( WM_KEYDOWN, VK_HOME, 0 ) ) ; //oRich:SetText( cTxt ) ;  //
      VALID ( cTxt := oRich:SaveAsRTF(), .T. ) // oRich:GetText(), .T. )


return nil

Static Function Graba(cTxt)
       IF MsgYesNo( "DESEA GRABAR INFORME",, )
                        Sele a
                            go top
                            if !eof()
                            do while .t.
                                     if flock()
                                            Repl Det_Exa With cTxt              // Grabo la Firma en la Dbf
                                        DBCommit()
                                        dbunlock()
                                        exit
                               else
                                        Msgwait( "Espere Archivo Ocupado","ESPERE",5 )
                               endif
                            enddo

                            endif

                  Tone( 3000 )
            EndIf

 
FWH 22.10 - HARBOUR - PELLES C
remtec
 
Posts: 717
Joined: Fri May 12, 2017 2:50 pm

Re: Ayuda con RTF

Postby remtec » Mon Jul 25, 2022 9:53 pm

Amigos

Ya lo solucione.

Por si alguien le sirve el código, esto permite grabar un campo memo con texto RTF enriquecido, recupera el texto, permite actualizarlo y volver a grabarlo.

Saludos

Antonio

Code: Select all  Expand view

function Act_eco2()

   local oDlg
   local oRich

   local lSyntaxHL := .f.
   local cTxt      := ""
     Local oFont1,oFont2,oSay1,oSay2,oSay3,oSay4

        Abre_dbf("TipExa",1,.f.,"")
    Set inde to TipExa
        Go top
         if eof()
         MsgStop(" ARCHIVO TIPOS DE EXAMENES VACIO")
             Dbclosearea()
             Return .f.
     endif

      If eof()
                 cTxt =  ""
      Else
                 cTxt:=a->Det_Exa
        Endif
        Define Font oFont1 Name "Curier New" Size 0,16  BOLD
      Define Font oFont2 Name "Curier New" Size 0,18  BOLD

        Define Font oFont  Name "Courier new" Size 0,22   BOLD

    DEFINE DIALOG oDlg SIZE 800,550 PIXEL TRUEPIXEL FONT oFont1   STYLE nOR(WS_POPUP) TRANSPARENT


    oDlg:lHelpIcon   := .F.


         @  90, 50 RICHEDIT5 oRich VAR cTxt OF oDlg PIXEL SIZE 700, 350// FILE "rtf4.rtf" //FILE "TestRTF.RTF"

        @ 480,150 BTNBMP oBTN1 SIZE 75, 50 PROMPT "ACEPTAR" OF oDlg 2007 Resource "#8023" FONT oFont1 ;
                        ToolTip "GRABA" ;
                        ACTION (cTxt := oRich:SaveAsRTF(),Graba(cTxt))           // Aqui Boton Acepta
        @ 480,450 BTNBMP oBTN2 SIZE 75, 50 PROMPT "SALIR"  OF oDlg PIXEL 2007 Resource "#8028"  FONT oFont1;
                        ToolTip  "SALIR DEL SISTEMA";
                        ACTION (oDlg:End())

   ACTIVATE DIALOG oDlg CENTERED ;  //
      ON INIT ( oRich:LoadRtf( cTxt ), oRich:PostMsg( WM_KEYDOWN, VK_HOME, 0 ) ) ;
      VALID ( cTxt := oRich:SaveAsRTF(), .T. )


return nil

Static Function Graba(cTxt)
       IF MsgYesNo( "DESEA GRABAR INFORME",, )
                        Sele a
                            go top
                            if !eof()
                            do while .t.
                                     if flock()
                                            Repl Det_Exa With cTxt              // Grabo el Texto RTF enriquecido en la Dbf
                                        DBCommit()
                                        dbunlock()
                                        exit
                               else
                                        Msgwait( "Espere Archivo Ocupado","ESPERE",5 )
                               endif
                            enddo

                            endif

                  Tone( 3000 )
            EndIf
    Return

 
Last edited by remtec on Wed Jul 27, 2022 5:47 pm, edited 1 time in total.
FWH 22.10 - HARBOUR - PELLES C
remtec
 
Posts: 717
Joined: Fri May 12, 2017 2:50 pm

Re: Ayuda con RTF

Postby Antonio Linares » Wed Jul 27, 2022 6:02 am

gracias por compartirlo!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41329
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 18 guests