Page 1 of 1

Line wrapping in DCMULTILINE

Posted: Mon Apr 11, 2022 9:47 pm
by Eugene Lutsenko
What parameters should I use to access the DCMULTILINE so that it displays text with line breaks along a certain width or window width?

And more. I made buttons in DCMULTILINE to launch my functions. For some reason, when the DCMULTILINE is launched, the function corresponding to the last button is launched. How to remove it?

Re: Line wrapping in DCMULTILINE

Posted: Mon Apr 11, 2022 11:22 pm
by k-insis
as pt.A)

Use NOHORIZSCROLL clause

also you can set font, set max alloved chars, etc

@ 1,1 DCMULTILINE cText FONT "10.Courier" SIZE 120,35 NOHORIZSCROLL MAXCHARS 60000

Not sure about pt.B, can you provide part of code ?
Eugene Lutsenko wrote: Mon Apr 11, 2022 9:47 pm What parameters should I use to access the DCMULTILINE so that it displays text with line breaks along a certain width or window width?

And more. I made buttons in DCMULTILINE to launch my functions. For some reason, when the DCMULTILINE is launched, the function corresponding to the last button is launched. How to remove it?

Re: Line wrapping in DCMULTILINE

Posted: Mon Apr 11, 2022 11:47 pm
by Eugene Lutsenko
Thank you, k-insis! It works perfectly, what you need. The code snippet is below.

Code: Select all

@2.7, 0 DCMULTILINE cOutString FONT "12.Courier" SIZE nWidth,40 NOHORIZSCROLL OBJECT oMemo

d = 5
w = 2

mStr = IF(mLanguage=1,'Помощь','Help')
@43.3, 0           DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := MessHelp(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Создать ключ','Create key')                                                                                      
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| CreateKey() }
mStr = IF(mLanguage=1,'Показать ключ','View key')                                                                                       
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := ViewKey(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Каталог сообщений','Message catalog')                                                                            
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := HypLinksMess(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Стереть','Erase')                                                                                                
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := Erase(), DC_GetRefresh(GetList) }  
mStr = IF(mLanguage=1,'Зашифровать в TXT','Encrypt in TXT')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := Crypton(cOutString), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Закодировать в BMP','Encode in BMP')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| TXTtoBMP(cOutString) }
mStr = IF(mLanguage=1,'Посмотреть BMP','View BMP')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| ViewBMP() }
mStr = IF(mLanguage=1,'Записать в облако','Write to the cloud')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| SaveCloud(cOutString) }
*********************************
mStr = IF(mLanguage=1,'Скачать из облака','Download from the cloud')
@43.3, DCGUI_COL+d+20 DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w, 1.5 OBJECT oButton ACTION {|| cOutString := LoadCloud(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Расшифровать из TXT','Decrypt from TXT')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := DecipherMess() }
mStr = IF(mLanguage=1,'Расшифровать из BMP','Decrypt from BMP')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := BMPtoTXTMess() } // <<<===############## почему-то при запуске DCMULTILINE сразу выполняется эта функция
*********************************

DCGETOPTIONS SAYWIDTH 76 SAYRIGHTBOTTOM
DCREAD GUI FIT TITLE '(C°) Crypton-messenger' ;
   OPTIONS GetOptions ;
   EVAL {||PostAppEvent(xbeP_Activate,,,oButton)}
************************************************************************************************

RETURN NIL

Re: Line wrapping in DCMULTILINE

Posted: Wed Apr 13, 2022 1:33 am
by k-insis
Hello.

Did you tried embedding strings into command directly ?

like this:

@43.3, 0 DCPUSHBUTTON CAPTION (IIF(mLanguage==1,'Помощь','Help'));
SIZE LEN(IIF(mLanguage==1,'Помощь','Help'))+w,1.5;
OBJECT oButton;
ACTION {|| cOutString := MessHelp(), DC_GetRefresh(GetList) }




Eugene Lutsenko wrote: Mon Apr 11, 2022 11:47 pm Thank you, k-insis! It works perfectly, what you need. The code snippet is below.

Code: Select all

@2.7, 0 DCMULTILINE cOutString FONT "12.Courier" SIZE nWidth,40 NOHORIZSCROLL OBJECT oMemo

d = 5
w = 2

mStr = IF(mLanguage=1,'Помощь','Help')
@43.3, 0           DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := MessHelp(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Создать ключ','Create key')                                                                                      
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| CreateKey() }
mStr = IF(mLanguage=1,'Показать ключ','View key')                                                                                       
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := ViewKey(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Каталог сообщений','Message catalog')                                                                            
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := HypLinksMess(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Стереть','Erase')                                                                                                
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := Erase(), DC_GetRefresh(GetList) }  
mStr = IF(mLanguage=1,'Зашифровать в TXT','Encrypt in TXT')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := Crypton(cOutString), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Закодировать в BMP','Encode in BMP')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| TXTtoBMP(cOutString) }
mStr = IF(mLanguage=1,'Посмотреть BMP','View BMP')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| ViewBMP() }
mStr = IF(mLanguage=1,'Записать в облако','Write to the cloud')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| SaveCloud(cOutString) }
*********************************
mStr = IF(mLanguage=1,'Скачать из облака','Download from the cloud')
@43.3, DCGUI_COL+d+20 DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w, 1.5 OBJECT oButton ACTION {|| cOutString := LoadCloud(), DC_GetRefresh(GetList) }
mStr = IF(mLanguage=1,'Расшифровать из TXT','Decrypt from TXT')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := DecipherMess() }
mStr = IF(mLanguage=1,'Расшифровать из BMP','Decrypt from BMP')
@43.3, DCGUI_COL+d DCPUSHBUTTON CAPTION mStr SIZE LEN(mStr)+w,    1.5 OBJECT oButton ACTION {|| cOutString := BMPtoTXTMess() } // <<<===############## почему-то при запуске DCMULTILINE сразу выполняется эта функция
*********************************

DCGETOPTIONS SAYWIDTH 76 SAYRIGHTBOTTOM
DCREAD GUI FIT TITLE '(C°) Crypton-messenger' ;
   OPTIONS GetOptions ;
   EVAL {||PostAppEvent(xbeP_Activate,,,oButton)}
************************************************************************************************

RETURN NIL

Re: Line wrapping in DCMULTILINE

Posted: Wed Apr 13, 2022 4:33 am
by skiman
Hi,

Look for 'detached locals' on this forum. This is the solution for your problem.

Re: Line wrapping in DCMULTILINE

Posted: Wed Apr 13, 2022 5:30 pm
by Eugene Lutsenko
Thank you, skiman! I will try. I've already done something similar on Roger's advice

Re: Line wrapping in DCMULTILINE

Posted: Wed Apr 13, 2022 5:43 pm
by Eugene Lutsenko
This simple solution works great! Thanks, k-insis!

Code: Select all

@43.3, 0 DCPUSHBUTTON CAPTION (IIF(mLanguage==1,'Помощь','Help'));
        SIZE LEN(IIF(mLanguage==1,'Помощь','Help'))+w,1.5;
        OBJECT oButton;
        ACTION {|| cOutString := MessHelp(), DC_GetRefresh(GetList) }
But there is another significant and strange circumstance. In order for the function on the last button not to start when starting DC MULTILINE, it is necessary that the last button does not use the construction : DCGUI_COL