Thanks for the reply Antonio. Here's the code.
- Code: Select all Expand view RUN
// testmemh.prg
#include "FiveWin.ch"
#define STAT_DISP "D"
#define STAT_EDIT "E"
static cStat
function Main()
local oDlg, oGet
local cText := MemoRead( "testmemh.prg" )
cStat := STAT_DISP
define dialog oDlg resource "MemoEdit"
redefine get oGet var cText memo id 104 of oDlg readonly
redefine button id 101 of oDlg update ;
ACTION ( cStat := STAT_EDIT, ;
oGet:lReadOnly := .f., ;
ShowHideCaret(oGet), ;
oGet:SetFocus() )
redefine button id 102 of oDlg update ;
ACTION ( cStat := STAT_DISP, ;
oGet:lReadOnly := .t., ;
ShowHideCaret(oGet) )
redefine button id 103 of oDlg update cancel ;
ACTION oDlg:end()
activate dialog oDlg centered ;
on init ShowHideCaret(oGet)
return nil
//----------------------------------------------------------------------------//
function ShowHideCaret(oGet)
if cStat == STAT_DISP
HideCaret(oGet:hWnd)
else
ShowCaret(oGet:hWnd)
endif
return nil
The rc file,
- Code: Select all Expand view RUN
// testmemh.rc
MemoEdit DIALOG 18, 18, 231, 112
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "MemoEditing"
FONT 8, "Arial"
{
EDITTEXT 104, 4, 6, 180, 85, ES_MULTILINE | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Edit", 101, 191, 7, 36, 14
PUSHBUTTON "Save", 102, 191, 25, 36, 14
PUSHBUTTON "Cancel", 103, 191, 43, 36, 14
}
As you can see, everytime the mouse is clicked in oGet, irregardless of cStat, the caret will appear.
TIA