mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
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.


Link Copied to Clipboard