XSample_186()

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

XSample_186()

#1 Post by Eugene Lutsenko »

After editing the row to save it to a file on disk?

Code: Select all

STATIC FUNCTION XSample_186()

/* This example uses DC_FormatMemoToWidth() to perfectly
   fit memo text into an object based on its font */

LOCAL cText, GetList[0], GetOptions, nWidth, cFont, cOutString, oMemo, oButton

nWidth := 640
cFont := Pad('12.Courier',40)

TEXT INTO cText WRAP

Now is the time for all good men to come to the aid of their country.

The quick red fox jumped over the lazy dog's back.

When in the course of human events it becomes necessary to Narfel the Garthog, then let the Narfelling begin.

ENDTEXT

cOutString := cText

@ 1,0 DCSAY 'Width (in pixels)' GET nWidth PICTURE '999'
@ 2,0 DCSAY ' Font' GET cFont POPUP {|c|DC_PopFont(c)}

@ 3,0 DCMULTILINE cOutString  SIZE 70,14 ;
      FONT Alltrim(cFont) OBJECT oMemo

@18,0 DCPUSHBUTTON CAPTION 'Format Text' SIZE 12,1.2 ;
      OBJECT oButton ;
      ACTION {||cOutString := DC_FormatMemoToWidth(cText,nWidth,cFont), ;
                DC_GetRefresh(GetList), ;
                oMemo:setFontCompoundName(Alltrim(cFont))}

DCGETOPTIONS SAYWIDTH 150 SAYRIGHTBOTTOM

DCREAD GUI FIT TITLE 'String Format Test' ;
   OPTIONS GetOptions ;
   EVAL {||PostAppEvent(xbeP_Activate,,,oButton)}

RETURN nil

*** END OF EXAMPLE ***

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: XSample_186()

#2 Post by rdonnay »

MemoWrit('MyMemo.Txt',cOutString)
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: XSample_186()

#3 Post by Eugene Lutsenko »

rdonnay wrote:MemoWrit('MyMemo.Txt',cOutString)
Thank You, Roger! Happened. And I wrote: MemoWrit('MyMemo.Txt',cText). It would Seem a small distinction, but important:)

Post Reply