TRichEdit control en un dialog

Post Reply
User avatar
TecniSoftware
Posts: 236
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

TRichEdit control en un dialog

Post by TecniSoftware »

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


#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
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: TRichEdit control en un dialog

Post by cnavarro »

Prueba asi, aunque te recomiendo utilizar el control TRichEdt5

Code: Select all | Expand


#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
TecniSoftware
Posts: 236
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Re: TRichEdit control en un dialog

Post by TecniSoftware »

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

Code: Select all | Expand


#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
Post Reply