Hey, I've got a couple questions on editorgadgets, both concerning API (I'm assuming).
First, how do I enable word-wrap, and second, how can I automatically scroll it to the bottom when a line is added (like a ENSUREVISIBLE message for editorgadgets...)?
Thanks in advance.
EditorGadget scrolling
Re: EditorGadget scrolling
kenmo wrote: First, how do I enable word-wrap
Code: Select all
SendMessage_(GadgetID(Gadget),#EM_SETTARGETDEVICE, #Null, Flag); Flag: 0 = WordWrap or 1 = no WordWrap
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

The following will scroll the editor gadget in order to show the last line in the control. However, if there are more lines than are visible, then it scrolls until the final line is at the very top of the client area.
The only way I can find of scrolling to put the last line at the bottom of the visible area involves some dirty scumy hit-testing in order to determine how many rows are visible within the control. I guess I shouldn't be surprised that I can't find an easy way of doing this, considering all the different font sizes which are possible etc.
The only way I can find of scrolling to put the last line at the bottom of the visible area involves some dirty scumy hit-testing in order to determine how many rows are visible within the control. I guess I shouldn't be surprised that I can't find an easy way of doing this, considering all the different font sizes which are possible etc.
Code: Select all
topvisible=sendmessage_(gadgetid(0), #EM_GETFIRSTVISIBLELINE,0,0)
sendmessage_(gadgetid(0), #EM_LINESCROLL, 0, countgadgetitems(0)-topvisible-1)
I may look like a mule, but I'm not a complete ass.
Actually that's specifically what I'm looking for... I assumed there WAS an easy way to do it. In any application's editor window, if you press CTRL+End it takes you to the bottom, but what message is performing that?srod wrote:The only way I can find of scrolling to put the last line at the bottom of the visible area involves some dirty scumy hit-testing in order to determine how many rows are visible within the control. I guess I shouldn't be surprised that I can't find an easy way of doing this, considering all the different font sizes which are possible etc.
Doh!
How about this:
Seems to do the job!
How about this:
Code: Select all
SendMessage_(gadgetid(0), #EM_SETSEL,-1,-1)
I may look like a mule, but I'm not a complete ass.