This is my first try at RichEdit ... I have an Ms Access table with an attribute set to Text .. I have no problem saving plain text or retrieving plain text and Add\Editing it using MEMO.. However, Using the same basic Principal from richedit.ch .. I can Redefine the object and variable .. however I cannot get the code to reveal any text in my dialog box .. I know the cRtf variable has content .. see image, but the variable never resolves in the Dialog .. Here is my code:
- Code: Select all Expand view RUN
Try
hRichDll := LoadLibrary( "riched20.dll" )
Catch
Return(.f.)
ENd Try
cLetter := oRsLetter:Fields("BODY"):Value
..
..
..
REDEFINE BTNBMP oButt3 PROMPT cRtPrompt ID 123 of oDlg LEFT 2007 ; // letter
RESOURCE "LETTER32";
ACTION ( _ViewMemo( cMode, Substr(cName,1,30), oRsLetter, oButt3, @cRtPrompt, @cLetter ));
GRADIENT DarkGreyButtonGrad()
//-----------------------------
Static FUNC _ViewMemo( cMODE, cTitle, oRsLetter, oButt3, cRtPrompt, cLetter )
Local SAYING, oUSERS
Local oRTF, cRTF, oBtn1,oBtn2
Local lOk,nLen,cOldMemo
Lok := .f.
cOldMemo := cLetter
If empty( cTitle )
cTitle := "Text Viewer"
Endif
Do Case
Case cMode = "E"
cTITLE := cTitle +" EDIT"
Case cMode = "A"
cTITLE := cTitle +" ADD"
Case cMode = "V"
cTITLE := cTitle +" VIEW"
EndCase
cRtf := cLetter
msginfo( cRtf ) // have content here
SetDlgGradient() // reset to blank
DEFINE DIALOG oUSERS RESOURCE "MEMO" ;
TITLE cTITLE ;
IF cMODE = "E" .or. cMode = "A"
REDEFINE RICHEDIT oRtf VAR cRtf ID 130 of oUSERS //UPDATE
ELSE // view
REDEFINE RICHEDIT oRtf VAR cRtf ID 130 of oUSERS READONLY //COLOR CLR_BLACK, 15987697 READONLY
ENDIF
REDEFINE BTNBMP oBtn1 ID 111 of oUSERS ; // ok
RESOURCE "OK", "DOK", "DOK" ;
PROMPT "&Ok" LEFT 2007;
ACTION ( lOk := .t.,;
If( lOk = .t., cLetter := cRtf, ),;
If( lOk = .t., oUSERS:END(),) )
REDEFINE BTNBMP oBtn2 ID 112 of oUSERS ; // cancel
RESOURCE "CANCEL", "DCANCEL", "DCANCEL" ;
PROMPT "&Cancel" LEFT 2007;
ACTION lOk := .f., oUSERS:END()
ACTIVATE DIALOG oUSERS ;
ON INIT ( oUsers:Move(100,250) );
VALID (!GETKEYSTATE( 27 )) ; // do not allow esc key here
If cMode = "V"
cLetter := cOldMemo
Endif
If lOk = .t.
nLen := Len( cLetter )
Do Case
Case nLen = 0
cRtPrompt := "Create Letter"
Case nLen > 0
cRtPrompt := "View Letter"
End Case
oButt3:cCAPTION := cRtPrompt
* oBtn3:SetColor( "R+/W*" )
oButt3:ReFresh()
ENdif
LightGreyGrad()
RETURN( NIL )
Memo.Rc
- Code: Select all Expand view RUN
// Generated by ResEdit 1.6.6
// Copyright (C) 2006-2015
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
MEMO DIALOG 13, 35, 387, 303
STYLE WS_POPUP | WS_CAPTION
FONT 6, "MS Sans Serif"
{
LTEXT "Text", -1, 2, 9, 21, 8
EDITTEXT 130, 25, 8, 355, 245, ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_TABSTOP
CONTROL "Ok", 111, "TBtnBmp", 32 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 281, 265, 41, 25
CONTROL "Cancel", 112, "TBtnBmp", 32 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 327, 265, 41, 25
}
Any Ideas ??
Rick Lipkin