Page 1 of 1

DCMULTILINE characters left

Posted: Tue Jun 22, 2021 11:03 am
by jdsoft
Hello

How i can keep track of the number of availeble characters in DCMULTILINE?

Code: Select all

@ nLine  , 1            DCMULTILINE oConsulten:Omschrijving   SIZE 100,8   NOHORIZSCROLL  MAXCHARS 950 
On every keystroke i want to show: nnn characters left.

Re: DCMULTILINE characters left

Posted: Tue Jun 22, 2021 12:57 pm
by rdonnay
Here you go, Jack. This works for me.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oBody, cBody, oSay

TEXT INTO cBody WRAP
This is
a test
of the memo
system showing remaining
characters.

ENDTEXT

@ 4,0 DCMULTILINE cBody SIZE 40,10 OBJECT oBody MAXCHARS 300 ;
    EVAL {|o|o:keyboard := DC_MergeBlocks(o:keyboard,{||DC_GetRefresh(oSay)})}

@ 15,0 DCSAY {||IIF(Valtype(oBody)=='O',oBody:maxChars-Len(oBody:editBuffer()),'')} SIZE 30 ;
       SAYOBJECT oSay FONT '16.Lucida Console'

DCREAD GUI FIT TITLE 'Memo Test' ;
   EVAL {||SetAppFocus(oBody), ;
           GoToBottom(oBody)}

RETURN nil

PROC appsys ; return

Re: DCMULTILINE characters left

Posted: Wed Jun 23, 2021 6:21 am
by jdsoft
Thank you verry much,