Page 1 of 1
use of memoedit doesn't work correctly
Posted: Thu Jun 12, 2014 1:37 am
by obelix
Hi everybody,
I'm using the following code:
m_baustein:="example"
cmemo:=MemoRead(m_baustein)
//cmemo is "" instead of "example"
cmemo:=DC_GuiMemoEdit(cmemo,7,3,tiefe,weite+3)
// cmemo is the edited text
ok=MemoWrit(m_baustein,cmemo)
// of ist false, m_baustein is "example" instead of the text edited in memoedit()
1. What's wrong with my code?
2. Is it possible to change the font used in the DC_GuiMemoEdit()-Window?
Re: use of memoedit doesn't work correctly
Posted: Thu Jun 12, 2014 3:44 am
by Tom
MemoRead expects a filename and returns it's contens. Is there a file named "example" (without extension)? I assume you're trying to edit the contens of "m_baustein" instead of the contens of a file called "example". Right?
DC_GuiMemoEdit works with "8.Courier" as the fixed editing font. You may just take the code for "DC_GuiMemoEdit" from _DCMEMOE.PRG (..\Source\DCLIPX), add it to your code, rename the function and replace font settings (search&replace "8.Courier").
Re: use of memoedit doesn't work correctly
Posted: Thu Jun 12, 2014 4:41 am
by Tom
Code: Select all
m_baustein:="example"
cmemo:=DC_GuiMemoEdit(m_baustein,7,3,tiefe,weite+3)
* cMemo is the edited text, m_baustein is still "example"
* write to disk:
MemoWrit("c:\test\example.txt",cMemo)
Instead of using "DC_GuiMemoEdit", you may create your own short dialog with DCMULTILINE:
Code: Select all
FUNCTION EditText(c)
LOCAL lOk := .F., cTextBackup := c
@ 0,0 DCMULTINE c SIZE 120,20 COMPATIBLE FONT "10.Arial"
DCREAD GUI ADDBUTTONS TO lOk TITLE 'Edit'
IF !lOk
c := cTextBackup
ENDIF
RETURN c
Re: use of memoedit doesn't work correctly
Posted: Thu Jun 12, 2014 5:22 am
by obelix
Thank you Tom,
again and again it's you to give me the decisive advice.
DCMULTILINE is even more flexible and convenient to my problem.
Peter
Re: use of memoedit doesn't work correctly
Posted: Thu Jun 12, 2014 5:46 am
by Tom