Page 1 of 1

Simple RTF controll

Posted: Fri Nov 09, 2012 12:26 pm
by jdsoft
Hello,

Attached you find a simple RTF control.
Screenshot.jpg
Screenshot.jpg (55.38 KiB) Viewed 7128 times
This can easy be included in your Express application.
However, it can be inproved visualy (especialy the toolbar), re-size and drag-drop is not supported.
The code can be improved.

Code: Select all

/*
 Sample programm for a RTF edit control in express++

 If your application uses a ARC file, you might want to alter DcRtfEdit.ch.
 Change the values of the #define for the resources.

 */

#include "Common.ch"
#include "DcDialog.ch"
#include "DcRtfEdit.ch"
#define COLOR_ORANGE GraMakeRGBColor( { 253, 120,  41 } )

Procedure Main()
LOCAL GetList        := {}
LOCAL nLine          := 1
LOCAL nTab           := 22
LOCAL lOk            := FALSE
LOCAL lHide          := FALSE
LOCAL lWhen          := TRUE
LOCAL cRtf           := MemoRead("RtfSample.rtf")
LOCAL oRtf           := nil
@ nLine++, nTab   DCCHECKBOX  lWhen CAPTION "Rtf editor is active (WHEN {||TRUE})" ACTION Dc_GetRefresh(oRtf)
@ nLine++, nTab   DCCHECKBOX  lHide CAPTION "Rtf editor is hidden (HIDE {||TRUE})" ACTION Dc_GetRefresh(oRtf)
nLine++
@ nLine  , nTab   DCRTFEDIT cRtf OBJECT oRtf    ;
                  SIZE     120,18               ;
                  CAPTION  "A RTF text box"     ;
                  FONT  "9.Arial Bold"          ;
                  WHEN  {||lWhen}               ;
                  HIDE  {||lHide}               ;
                  COLOR COLOR_ORANGE

DCREAD GUI TO lOk FIT
if lOk
endif
oRtf:Destroy()                // <<<<<==== No not forget !!
oRtf                 := nil
Return

Procedure AppSys()
Return

Attached you find the sourcecode.
If you have improvements, please let me know.

Regards,
Jack Duijf