EPOC32, dEDITMULTI |
How to use dEDITMULTI is a question that pops up
occasionlly on Usenet. Here is how I use dEDITMULTI
to edit strings of upto 255 chars. This gives you a
multi line edit box with scroll bars.
dEDITMULTI uses an array of longs as a buffer for
the text being edited.ie you probably have text
to display/edit that is currently stored in a string
(maximum of 255 chars in opl).
You will need to prepare a buffer of longs, and
copy in the chars from your string into it,
call dEDITMULTI in a dialog, then copy the chars
back out of the buffer into a string. This gets messy,
as to complicate matters, the first long in the array,
holds the number of chars in it.
As I use dEDITMULTI so
often I have written two small procs which I call
either side of a DIALOG to do the messy copying
for me :
PROC stringIn:(str&,ptr&) LOCAL i%,n% n%=PEEKB (str&) i%=0 WHILE i%<n% POKEB ptr&+4+i%,PEEKB(str&+1+i%) i%=i%+1 ENDWH POKEL ptr&,n% ENDP PROC stringOut:(ptr&,str&) LOCAL i%,n% n%=PEEKL (ptr&) i%=0 WHILE i%<n% POKEB str&+1+i%,PEEKB(ptr&+4+i%) i%=i%+1 ENDWH POKEB str&,n% ENDP PROC xyz: LOCAL buff&(66) rem (1+(255+3)/4) LOCAL str$(255) str$="Some text" stringIn:(ADDR(str$),ADDR(buff&(1))) dINIT "Foo" dEDITMULTI ADDR(buff&(1)),"prompt here",20,2,255 dBUTTONS "Cancel",-%c,"Save",%s IF DIALOG stringOut:(ADDR(buff&(1)),ADDR(str$)) print str$ ENDIF ENDP
©1998 Phil Whiles |
Go Home ! | Last revised: 26th May '98 |