mIRC Homepage
Posted By: Xanadu sclick in an edit box - 12/07/03 08:11 AM
I have a dialog with an edit box linked to %varname. %vaname's info is a folder. What I would like to do is set it to open $sdir when the edit box is clicked, but it is not working for me. Any ideas how to do this with 6.03?

Thanks
Posted By: Hammer Re: sclick in an edit box - 12/07/03 10:07 AM
From /help $sdir:

$sdir(dir,title)
Displays the select folder dialog and returns the selected folder. Title is optional.

From that, it would seem logical that you could probably use /run $$sdir(%varname, Message goes here), like this:
Code:

on *:DIALOG:dname:sclick:EditID: run $$sdir(%varname, Folder: %varname)

The problem is that an edit control does not react to :sclick: or :dclick:, so you'll have to give it a button to kick it off.
Code:

alias bergle dialog -m bergle bergle
 
dialog bergle {
  option dbu
  size -1 -1 100 100
  title Testing editbox sclick event
 
  edit   ""    , 1,  5  5 90 13
  button "Open", 2, 40 80 20 15, ok
}
 
on *:DIALOG:bergle:*:*:{
  var %varname = $getdir(jpg)
  if $devent != mouse echo -s * Event: $devent for ID: $did
  if $devent == init did -a $dname 1 %varname
  if $devent == sclick && $did == 2 run $sdir(%varname, Pick your poison $+ $chr(3) pardner)
}

You can use this sample code to show how clicking like a fiend in the editbox generates no events, then click on the Open button and see how everything works from there. (I filtered out the mouse event to keep you from going insane; however, be aware that anytime you move your mouse over the dialog, a mouse event is generated...LOTS of them.)
Posted By: Xanadu Re: sclick in an edit box - 12/07/03 02:36 PM
I was hoping there was a way to get it to trigger off a click in the editbox instead of a button, but thanks.
Posted By: pheonix Re: sclick in an edit box - 12/07/03 02:38 PM
put a button over the edit box and then hide the buttn so it looks like a click on the edit box cool
© mIRC Discussion Forums