mIRC Home    About    Download    Register    News    Help

Print Thread
dialog editbox with multi and autovs #261237
20/08/17 04:21 PM
20/08/17 04:21 PM
Joined: Jul 2006
Posts: 3,515
France
W
Wims Offline OP
Hoopy frood
Wims  Offline OP
Hoopy frood
W

Joined: Jul 2006
Posts: 3,515
France
I have an editbox with a not so big width and a normal height.
I do not want to allow the user to hit enter in the control to add a newline, but if the text on the first line goes beyond the width, it should then go to the next line to display the text correctly (I don't want a scrollbar).
The issue is that although there is only one line on the control, $did(dname,id) will only return what is visible on the first line only. It is possible to get the rest with $did(dname,id,N) however it is impossible to tell if a newline was added or not, and depending on where the line breaks, (on a space especially), it is not trivial to get the correct content of the editbox.

Shouldn't $did(dname,id) return the real first line in the control and $did().lines be 1 instead of 2?

Code:
dialog test {
size -1 -1 200 200
edit "",1,10 10 50 60, multi autovs
}
Open the dialog and enter text in the editbox so that it takes visually two lines to diplay the text and look at $did(dname,1)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: dialog editbox with multi and autovs [Re: Wims] #261253
23/08/17 11:21 AM
23/08/17 11:21 AM
Joined: Dec 2002
Posts: 4,449
London, UK
Khaled Offline

Hoopy frood
Khaled  Offline

Hoopy frood

Joined: Dec 2002
Posts: 4,449
London, UK
Thanks for your bug report. The Windows editbox considers these separate lines. When $did() asks the editbox how many lines there are, it replies with N lines. $did() then has to ask Windows for each Nth line, which corresponds to $did(dname,id,N).

Update: looking into this a little more, it turns out that Windows editbox line indexing ignores line breaks in wrapped lines. Line indexing forms the basis of many editbox windows messages, such as EM_GETLINECOUNT and EM_GETLINE, used throughout mIRC. The only way an application can get around this limitation is to implement its own custom parser and line indexing method and replace all of the line based Windows editbox messages that set/read/write/replace/etc. editbox lines with its own methods, which would not be practical unfortunately.