TRichEdit control en un dialog

TRichEdit control en un dialog

Postby TecniSoftware » Thu Feb 11, 2021 10:08 pm

Al ejectuar, el texto aparece seleccionado y no lo muestra desde el principio. Alguien tiene idea que puede ser?
En window funciona correctamente pero necesito poner el control en un dialog y no logro que funcione bien.

Code: Select all  Expand view

#include "FiveWin.ch"
#include "richedit.ch"

Function Main()

   local oDlg
   local oRtf
   local hRichDLL  := LoadLibrary( "riched20.dll" )
   local cFile     := "testrtf.rtf"
   local cText     := MemoRead( cFile )

   DEFINE DIALOG oDlg TITLE "Test" PIXEL FROM 10, 10 TO 400, 600

   @ 02, 02 RICHEDIT oRtf;
                 VAR cText;
                  OF oDlg;
               PIXEL;
                SIZE 200, 150;
            READONLY

   ACTIVATE DIALOG oDlg CENTERED

   FreeLibrary( hRichDLL )

Return NIL

 
Alejandro Cebolido
Buenos Aires, Argentina
User avatar
TecniSoftware
 
Posts: 235
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Re: TRichEdit control en un dialog

Postby cnavarro » Thu Feb 11, 2021 11:02 pm

Prueba asi, aunque te recomiendo utilizar el control TRichEdt5

Code: Select all  Expand view

#include "FiveWin.ch"
//#include "richedi5.ch"
#include "richedit.ch"

Function Main()

   local oDlg
   local oRtf
   local hRichDLL  := LoadLibrary( "riched20.dll" )
   local cFile     := "testrtf.rtf"
   local cText     := MemoRead( cFile )
   local cRtf      := ""

   DEFINE DIALOG oDlg TITLE "Test" PIXEL FROM 10, 10 TO 400, 600

   //@ 02, 02 RICHEDIT5 oRtf;
   @ 02, 02 RICHEDIT oRtf;
                 VAR cRtf;
                  OF oDlg;
               PIXEL;
                SIZE 200, 150 ;
            READONLY

   oDlg:bStart = { || oRtf:SetPos( 0 )}

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oRtf:LoadRtf( cText ) )

   FreeLibrary( hRichDLL )

Return NIL
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TRichEdit control en un dialog

Postby TecniSoftware » Thu Feb 11, 2021 11:13 pm

cnavarro wrote:Prueba asi, aunque te recomiendo utilizar el control TRichEdt5

Code: Select all  Expand view

#include "FiveWin.ch"
//#include "richedi5.ch"
#include "richedit.ch"

Function Main()

   local oDlg
   local oRtf
   local hRichDLL  := LoadLibrary( "riched20.dll" )
   local cFile     := "testrtf.rtf"
   local cText     := MemoRead( cFile )
   local cRtf      := ""

   DEFINE DIALOG oDlg TITLE "Test" PIXEL FROM 10, 10 TO 400, 600

   //@ 02, 02 RICHEDIT5 oRtf;
   @ 02, 02 RICHEDIT oRtf;
                 VAR cRtf;
                  OF oDlg;
               PIXEL;
                SIZE 200, 150 ;
            READONLY

   oDlg:bStart = { || oRtf:SetPos( 0 )}

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oRtf:LoadRtf( cText ) )

   FreeLibrary( hRichDLL )

Return NIL
 


Cristobal, ud. es un genio, es exactamente lo que necesitba, habia probado con SetPos() pero no lograba hacerlo funcionar.
Muchisimas gracias maestro
Alejandro Cebolido
Buenos Aires, Argentina
User avatar
TecniSoftware
 
Posts: 235
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests