mIRC Home    About    Download    Register    News    Help

Print Thread
How do i get cursor position in editbox? #29600 13/06/03 07:53 PM
Joined: May 2003
Posts: 78
M
MauS Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: May 2003
Posts: 78
Subj.

I need to copy clicked nick in the position of the cursor


-= endless in a victory of a yourself =-
Re: How do i get cursor position in editbox? #29601 13/06/03 07:54 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
/clipboard $$1


new username: tidy_trax
Re: How do i get cursor position in editbox? #29602 13/06/03 08:06 PM
Joined: May 2003
Posts: 78
M
MauS Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: May 2003
Posts: 78
That's not what i want


-= endless in a victory of a yourself =-
Re: How do i get cursor position in editbox? #29603 13/06/03 08:36 PM
Joined: Jan 2003
Posts: 108
H
Hindsight Offline
Vogon poet
Offline
Vogon poet
H
Joined: Jan 2003
Posts: 108
In the postion of the cursor?

Re: How do i get cursor position in editbox? #29604 13/06/03 09:00 PM
Joined: May 2003
Posts: 78
M
MauS Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: May 2003
Posts: 78
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


-= endless in a victory of a yourself =-
Re: How do i get cursor position in editbox? #29605 14/06/03 02:21 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato
Re: How do i get cursor position in editbox? #29606 14/06/03 01:43 PM
Joined: Jan 2003
Posts: 25
N
NoScRiPtR Offline
Ameglian cow
Offline
Ameglian cow
N
Joined: Jan 2003
Posts: 25
um .. what's wrong with typing the first letter or two of the nick and hitting tab?


But then again, what do I know ... I'm NoScRiPtR wink
Re: How do i get cursor position in editbox? #29607 14/06/03 03:25 PM
Joined: Dec 2002
Posts: 169
J
Jerk Offline
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
$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)) }
}

Re: How do i get cursor position in editbox? #29608 15/06/03 02:12 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Provided that we're talking about dialog editboxes. Even though I read every post in this thread, I couldn't determine that smile


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: How do i get cursor position in editbox? #29609 15/06/03 05:18 PM
Joined: Dec 2002
Posts: 169
J
Jerk Offline
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
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.

Re: How do i get cursor position in editbox? #29610 16/06/03 10:07 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
That's a pretty damn good idea. You don't even need the cursor position this way.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: How do i get cursor position in editbox? #29611 17/06/03 11:16 PM
Joined: Feb 2003
Posts: 2,650
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,650
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!