mIRC Homepage
Posted By: MauS How do i get cursor position in editbox? - 13/06/03 07:53 PM
Subj.

I need to copy clicked nick in the position of the cursor
Posted By: pheonix Re: How do i get cursor position in editbox? - 13/06/03 07:54 PM
/clipboard $$1
Posted By: MauS Re: How do i get cursor position in editbox? - 13/06/03 08:06 PM
That's not what i want
In the postion of the cursor?
Posted By: MauS Re: How do i get cursor position in editbox? - 13/06/03 09:00 PM
I mean TO the position of the cursor.

For example: i set cursor to a position (in middle of text) in the editbox. Then i doubleclick a nick and my mouse nicklist action should copy that nick to the position i've set
you can't get the cursor position. If i get what u mean you're saying say you had an edit bot:

[Some text_____]
and you put the cursor where the red bar is
[Some |text_____]
Then you want to put text in that position of the cursor..

You can't. There no $did(id).cursorpos property or anything.
um .. what's wrong with typing the first letter or two of the nick and hitting tab?
Posted By: Jerk Re: How do i get cursor position in editbox? - 14/06/03 03:25 PM
$did().selstart works. Using $mid, $did().selstart and $did().selend it should be easy to insert text into an editbox at the cursor position. Example:
Code:
alias inserteditbox {
  var %dname = $$1
  var %id = $$2
  var %itext = $$3-
  var %text = $did(%dname,%id)
  if ($did(%dname,%id).selstart == 0) { did -o %dname %id 1 %itext $+ %text }
  else { did -o %dname %id 1 $mid(%text,1,$did(%dname,%id).selstart) $+ %itext $+ $mid(%text,$calc($did(%dname,%id).selend + 1)) }
}
Posted By: qwerty Re: How do i get cursor position in editbox? - 15/06/03 02:12 PM
Provided that we're talking about dialog editboxes. Even though I read every post in this thread, I couldn't determine that smile
Posted By: Jerk Re: How do i get cursor position in editbox? - 15/06/03 05:18 PM
True. I assumed that it was editboxes in dialogs from KingTomato's post :tongue:

For channel nicklists and editboxes I suppose you could get around the issue by using your sendkeys alias to send shift-tab (to go back to the editbox) and then sendkey the nickname. Or you could copy the nick to the clipboard and then sendkey +{TAB}^V (that way you dont have to worry about nicks containing ^{}[])
Code:
alias sendkeys var %a = sendkeys $+ $ticks | .comopen %a WScript.Shell | if !$comerr { .comclose %a $com(%a,SendKeys,3,bstr,$1-) }
alias inserteditbox {
  clipboard $$1
  ; shift tab back to the edit box, ctrl v to paste.  
  sendkeys +{TAB}^V
}
Nick List: /inserteditbox $1

Not pretty but it should work and do what the original poster wanted.
Posted By: qwerty Re: How do i get cursor position in editbox? - 16/06/03 10:07 AM
That's a pretty damn good idea. You don't even need the cursor position this way.
Posted By: Raccoon Re: How do i get cursor position in editbox? - 17/06/03 11:16 PM
Except that you can't tell if you selected from the Nicklist side-listbox popup, or from the Nicklist nick-appearing-in-channel popup. If you Shift+Tab when clicking a nick in the channel, you'll end up in the side-listbox.

- Raccoon
© mIRC Discussion Forums