FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MemoEdit, Multi-Line Get MEMO from Resources
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
MemoEdit, Multi-Line Get MEMO from Resources
Posted: Thu May 15, 2014 04:56 PM
To All

I have a text string that has been saved to a Sql Text field... no problems there. When I extract the formatted text from the field, I get perfectly formatted text back, and the multi-line shows the text great .. however, it takes a LOT of WORK to try to format the text the way I want it.

I have created a small sample to show my problem .. I have looked on this forum and the samples and can not successfully find an example of editing 'plain text' from a variable in a Redefine GET .. MEMO line... I am lot looking for a RichEdit solution ..

When you compile the program, you will notice you can not indent, or use the Enter Key to create paragraphs .. the text has no controls for editing.

I have found various examples of MemoEdit from files, but nothing from a string variable from Resources. I know there must be a simple answer ..

Thanks
Rick Lipkin

Code (fw): Select all Collapse
#Include "FiveWin.Ch"

//-----------------------------
FUNC _ViewMemo() // cMODE, cTitle, oRsType, oButt3, cRtPrompt,cLetter  )

Local SAYING, oUSERS
Local oMEMO, cMEMO, oBtn1,oBtn2
Local lOk,nLen,cOldMemo

cMode   := "E"
cTitle  := "Text Viewer"

cLetter := "To Whom it May Concern :"
cLetter += "You are hereby notified that your bank has returned the above referenced check/draft to the SC"
cLetter += "Department of Xxxxxxxxx (SC XXX). Pursuant to South Carolina Law, you have thirty (30) days from the date"
cLetter += "this notice was mailed to tender payment of the full amount, plus a service charge. The amount of the"
cLetter += "check, the service charge and the date payment is due are indicated above."
cLetter += "  "
cLetter += "Any payment for this return check/draft must include all applicable fees and penalties. Payment by mail must"
cLetter += "be by cashier's check, money order or certified check made payable to SC XXX. Personal checks are NOT"
cLetter += "acceptable. Cash payments are acceptable, but they must be personally delivered to our Finance"
cLetter += "Department at the address above. Please return this letter with your payment and indicate on your payment"
cLetter += "the invoice number ( top right-hand corner ). Unless this amount is paid in full by the above due date your"
cLetter += "icense will be cancelled."
cLetter += "  "
cLetter += "Should you have any questions, please feel free to contact Xxxxx Xxxxxxx at (803)xxx-xxxx."
cLetter += "  "
cLetter += "Sincerely,"
cLetter += "  "
cLetter += "Xxxx X. Xxxxxx, CPA,PMP"
cLetter += "Director of Finance"

lok      := .f.
cOldMemo := cLetter

Do Case
Case cMode = "E"
     cTITLE := cTitle +"     EDIT"
Case cMode = "A"
     cTITLE := cTitle +"      ADD"
Case cMode = "V"
     cTITLE := cTitle +"     VIEW"
EndCase

cMemo := cLetter

If empty( cMemo) .or. cMemo = "  "
Else
   cMemo := alltrim( cMemo )
Endif


DEFINE DIALOG oUSERS RESOURCE "ITMEMO" ;
       TITLE cTITLE              ;


IF cMODE = "E" .or. cMode = "A"

   REDEFINE GET oMEMO      VAR cMEMO MEMO ID 130 of oUSERS UPDATE

ELSE     // view

   REDEFINE GET oMEMO      VAR cMEMO MEMO ID 130 of oUSERS COLOR CLR_BLACK, 15987697 READONLY

ENDIF


  *   IF cMODE = 'E'
        oMemo:bGotFocus = { || oMemo:SetSel( 0, 0 ),;
                         oMemo:Goto( oMemo:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }
  *   ENDIF

REDEFINE BTNBMP oBtn1 ID 111 of oUSERS   ;     // ok
         RESOURCE "OK", "DOK", "DOK" ;
         PROMPT "  &Ok    " LEFT 2007;
         ACTION ( lOk := .t.,;
                  If( lOk = .t., cLetter := cMemo, ),;
                  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

If cMode = "V"
   cLetter := cOldMemo
Endif

RETURN( NIL )

ITMEMO.Rc
Code (fw): Select all Collapse
ITMEMO 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 | 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
}
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: MemoEdit, Multi-Line Get MEMO from Resources
Posted: Thu May 15, 2014 07:46 PM
Code (fw): Select all Collapse
ITMEMO DIALOG 95, 64, 387, 303
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
FONT 8, "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
}
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: MemoEdit, Multi-Line Get MEMO from Resources
Posted: Thu May 15, 2014 07:55 PM

João

Awsome!! Thank you VERY much .. in comparing the two forms the main difference was ES_WANTRETURN ?

Thanks
Rick Lipkin

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: MemoEdit, Multi-Line Get MEMO from Resources
Posted: Thu May 15, 2014 07:58 PM

Yes Rick.

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion