mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2007
Posts: 933
5
5618 Offline OP
Hoopy frood
OP Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
I'm trying to do the following...

I have 4 edit boxes in a dialog which require you to fill out a mIRC color index number. I have added an icon with the mIRC color palette as image and would like people to be able to click on the image and the corresponding number will be filled out in the last selected edit box.

I can capture the selected number fine by looking at the mouse position during the sclick on the icon id. However, I can't seem to trigger an on DIALOG event when first clicking in an edit box (which I'd later refer to with the icon sclick). From the looks of it (also the help file) edit boxes do not support a sclick event. The same occurs - or rather, does not - when I use a combo edit box.

What is my best option here? Should I rely on my mouse position when selecting an edit box first or am I missing something?

I could of course use a dropdown menu with all 15 numbers, but that's not really the point of this exercise.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I would recommend forcing the user to select the edit box, then allow them to select the color code.

After they select the edit box, you can store that ID in a variable and enable the Icon ID while disabling the ID's for the edit boxes.
After they select the color code, disable the Icon ID, and re-enable the edit box ID's.

Since you'll be forcing the color selection after the edit box has been selected, you can use /did -f <Icon_ID> to put the focus on the Icon ID automatically.

Joined: Jun 2007
Posts: 933
5
5618 Offline OP
Hoopy frood
OP Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
I think you're missing the point. I can't store the ID of the edit box that was selected before clicking on the icon.

(forcing the user to first select/highlight the existing text in the edit box so you can use $did().seltext is not an option)

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Quote:
I can't store the ID of the edit box that was selected before clicking on the icon.
Why can't you?

I might be of more help if you posted your current dialog code.

Joined: Jun 2007
Posts: 933
5
5618 Offline OP
Hoopy frood
OP Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
The code isn't going to add something. I just want to be able to return the id of an edit box when I click it/put the cursor inside it.

Theoretically being...
on *:DIALOG:test:sclick:10:{ echo -s $did }
where id 10 is:
edit "text",10,80 290 30 20

But as I said, I get no response to sclick with an edit box id.

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
why not use:
Code:
on *:dialog:DIALOG_NAME:*:*: {
  if ($devent == init) {
  echo -s $dname opened.
  if ($devent == sclick) {
  if ($did == 10) { echo -s $did }
  elseif ($did == 11) { echo -s $did }
  }
  if ($devent == edit) {
  if ($did == 10) { echo -s $did(10).text }
  ; don't know how you can make one id (10) do two things tho
  }
  if ($devent == mouse) {
  ; maybe this one is something for you.
  if ($did == 10) { echo -s mouse is on $did }
 }
}



if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
From the help file
Quote:
sclick single click in list/combo box, or check/uncheck of radio/check buttons, or click of a button.

The sclick event does not respond when you select an edit box, with the exception of an edit box for a list/combo box (if the edit box is enabled)

Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
You could use a timer that check quickly some condition, with $mouse.key & 1 and $did, but i've tried this method and it's not really perfect, but could work.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2007
Posts: 933
5
5618 Offline OP
Hoopy frood
OP Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Yeah. I've tried several more approaches, but none are suitable for use. I guess I'll just have to abandon the function and go with something else.

Thanks though.


Link Copied to Clipboard