mIRC Homepage
Posted By: 5618 on DIALOG sclick and edit boxes - 14/12/08 06:31 PM
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.
Posted By: RusselB Re: on DIALOG sclick and edit boxes - 14/12/08 06:48 PM
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.
Posted By: 5618 Re: on DIALOG sclick and edit boxes - 14/12/08 06:53 PM
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)
Posted By: RusselB Re: on DIALOG sclick and edit boxes - 14/12/08 07:43 PM
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.
Posted By: 5618 Re: on DIALOG sclick and edit boxes - 14/12/08 08:05 PM
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.
Posted By: sparta Re: on DIALOG sclick and edit boxes - 14/12/08 08:46 PM
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 }
 }
}

Posted By: RusselB Re: on DIALOG sclick and edit boxes - 14/12/08 10:11 PM
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)
Posted By: Wims Re: on DIALOG sclick and edit boxes - 15/12/08 02:40 AM
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.
Posted By: 5618 Re: on DIALOG sclick and edit boxes - 15/12/08 03:36 PM
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.
© mIRC Discussion Forums