There's already an ON KEYDOWN event, but it works only in @win editbox not in #channel editbox. The closest I see getting now is to use $editbox($active) to find the text in that editbox. if $editbox($active).selstart and $editbox($active).selend are the same number, then that's the cursor position. If they're different, then some text has been highlighted, and the only thing you don't know is what happens when you press shift+arrow, since the .selstart and .selend values are sorted low/high which prevents you from knowing whether the text was selected left-to-right or right-to-left. That means if you try to re-create the editbox with /editbox -bNeN it won't preserve the true cursor position in the case of marking right-to-left.

What you described for highlighting or underlining mis-spelled words doesn't seem possible without a DLL of some kind. The editbox doesn't really have underlining or highlighting, it has 'selecting' which means it highlights the word by selecting it, which means as soon as the next keypress happens, the selection is replaced by your keypress. You might alternatively be forced to use a $tip message.

In a channel window, the only way to simulate the ON KEYDOWN event is to have a short interval timer that compares the current and prior $editbox(#channelname) to see if anything changed, then guess the cursor position based on .selstart and .selend and the altered text.

Last edited by maroon; 06/10/20 03:14 PM.