mIRC Home    About    Download    Register    News    Help

Topic Options
#232727 - 17/06/11 07:25 PM $input and dialog
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
When the script editor is open, the u option of $input does not work correctly with a dialog:
Code:
dialog test {
  size -1 -1 200 200
  button "$input" ,1, 80 80 60 25
}
on *:dialog:test:sclick:*:noop $input(a,uo)
type /dialog -m test test, click the button, as you can see you cannot activate the dialog.
Close the $input, open the script editor and click the button again, this time you can access the dialog.


Edited by Wims (17/06/11 07:26 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232728 - 18/06/11 01:31 AM Re: $input and dialog [Re: Wims]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
didn't think you were supposed to use $Input from an event.... just saying :X
_________________________
I am SReject
My Stuff

Top
#232729 - 18/06/11 03:23 AM Re: $input and dialog [Re: FroggieDaFrog]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
DIALOG events aren't the same. It's reasonable to allow $input to work in a dialog event. The lashback on using $input in events has to do with events that are out of the users control, like ON TEXT, since it's impossible for a user to know when that might trigger. ON DIALOG can only be triggered by the user, so it's okay.

That said, you probably shouldn't use the u switch with $input in a dialog, because it's likely that "u" is only made to be associated with parent MDI windows, not parent dialog windows.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#232734 - 18/06/11 01:53 PM Re: $input and dialog [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Quote:
That said, you probably shouldn't use the u switch with $input in a dialog, because it's likely that "u" is only made to be associated with parent MDI windows, not parent dialog windows.
I don't think it's true, or tell that to my dialog that use $input(,u,) since mIRC 6.35 without any problem (other than this one) and with the expected behavior.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232737 - 18/06/11 06:09 PM Re: $input and dialog [Re: Wims]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
The code you listed behaves exactly the same way in 6.35. FYI this behaviour is only reproduceable when the Remote Editor is not being shown on the desktop. But again, I can also reproduce this behaviour in 6.35, so this behaviour has been around for a while.

Why are you using the 'u' switch, exactly? Is your goal to make the $input modal?
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#232739 - 19/06/11 12:16 AM Re: $input and dialog [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
I talked about 6.35 because you said it wasn't supposed to work whereas it is working and the behavior is consistent since at least that version, but probably since the feature exists.
Quote:
Why are you using the 'u' switch, exactly? Is your goal to make the $input modal?
Yes, I don't want people to be able to use the dialog when one of my $input is called
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232750 - 20/06/11 03:09 AM Re: $input and dialog [Re: Wims]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
Originally Posted By: Wims
I talked about 6.35 because you said it wasn't supposed to work whereas it is working and the behavior is consistent since at least that version, but probably since the feature exists.


I'm not entirely sure that just because the behaviour hasn't changed in N years that it should work. By your logic, the fact that $input() does what it does now means that it can't be a bug, since it's been that way for so long. I certainly don't believe that's true, and I doubt you do too-- my point is that it's just as plausible that u was never really meant to work properly with dialog windows. Khaled would know better.

I guess the question is this: is using the 'u' switch *really* the recommended way to make a modal dialog with $input? The behaviour of "use the current active window as the parent window" doesn't really sound like that's what it is for.. so while you may have been getting the behaviour you want, it might have just been a side-effect, not a feature. In fact, the fact that u makes the dialog modal might be a bug in itself. There's no equivalent way to make an $input modeless in a non-dialog scenario (//echo -a $input(x) from a channel/status window is modal, same with the u switch), so maybe this was never intentional.

Maybe Khaled can answer the above question (how an $input can be declared modal in a dialog)-- I think that would clarify things.


_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#232755 - 20/06/11 05:09 AM Re: $input and dialog [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Quote:
I'm not entirely sure that just because the behaviour hasn't changed in N years that it should work
Indeed, that's not what makes it a bug or not.
Quote:
By your logic, the fact that $input() does what it does now means that it can't be a bug, since it's been that way for so long. I certainly don't believe that's true, and I doubt you do too--
Not sure why you bring "my logic" here if you doubt I beleive in it, but indeed, it's not true.
Quote:
my point is that it's just as plausible that u was never really meant to work properly with dialog windows.
You might be right, but frankly, seeing how the behavior is consitent and is working as it should, I do think $input(,u,) is supposed to work with dialog windows, better, why wouldn't it ? There would be a note in the help file..
Quote:

I guess the question is this: is using the 'u' switch *really* the recommended way to make a modal dialog with $input?

I don't want to make a modal dialog with $input, I just don't want people to be able to access the dialog if an $input from my code is called, ie: I do want the u switch, I do want the dialog to be the parent window of that $input.
Quote:
The behaviour of "use the current active window as the parent window" doesn't really sound like that's what it is for.. so while you may have been getting the behaviour you want, it might have just been a side-effect, not a feature. In fact, the fact that u makes the dialog modal might be a bug in itself. There's no equivalent way to make an $input modeless in a non-dialog scenario (//echo -a $input(x) from a channel/status window is modal, same with the u switch), so maybe this was never intentional.
I think you misunderstood the situation because you go astray here, "use the current active window as the parent window" does really sound like what I need, it's not a side effect, there's just this problem related to the script editor wink

Anyway, of course and as usual, hearing khaled on this would definitely help us
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232757 - 20/06/11 06:34 AM Re: $input and dialog [Re: Wims]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
Originally Posted By: Wims
I don't want to make a modal dialog with $input, I just don't want people to be able to access the dialog if an $input from my code is called


That is exactly what "modal" means, so, yes, you do want to make a modal dialog. However,

Originally Posted By: Wims
ie: I do want the u switch, I do want the dialog to be the parent window of that $input.


This does not follow. It might be true that all modal dialogs have parent windows (fyi, this is not even true, some modal dialogs have "no" parent windows), but it is NOT true that all windows with an associated parent window must necessarily be modal, which is what you're implying. There are situations where you could want a modeless dialog to assign a parent window, therefore "assign parent window" != "modal"; they are two fairly different behaviours. In your case, due to a side-effect of mIRC, you're under the impression that they're the same.

Originally Posted By: Wims
"use the current active window as the parent window" does really sound like what I need


It's not. "Use the current active window as the parent window" should do just that and nothing more. It should associate the MDI child window with the active window as a parent, ie. this. Associating with a parent has no effect on modality (modal or modeless). As an example, mIRC #channel windows are MDI child windows of the main mIRC window, but they are not modal. There are times when you would need the functionality of a child window in either a modal or a modeless scenario. Therefore, yes, it seems to me as though the modal behaviour of $input with u is a side-effect, unless Khaled intended on this. If so, it should be documented. Otherwise, we should have a separate switch to denote modeless/modal $input.

Finally, one last example of why you might want to use the 'u' switch to create a modeless (non-modal) $input() dialog inside of a dialog window: associating with a parent window will make it so that all child windows close when the parent window does. This can be important, especially with modeless dialogs. If you create an $input() and the parent window closes, you'd want the $input to close. The u switch would do this, in that case, but unfortunately the u switch would also make it modal. In this sense, the behaviour is different from the description in the help file, and it makes me question whether it's intended or not.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#232765 - 20/06/11 11:10 PM Re: $input and dialog [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Quote:
That is exactly what "modal" means, so, yes, you do want to make a modal dialog.
No wink you said "modal dialog", only $input is modal, the dialog is far from being modal

If you think there's a problem with the wording in the help file or if you think the ,u, behavior is bugged in general or regarding dialog window, feel free to make a post about it.

For my part, I use the u switch because otherwise, the $input isn't tied to my dialog and it makes that $input appearing behind the dialog ie: clearly not what I want.
It is working as I expect it to, except for the problem with the script editor, so I'm not going to stop using it because you are supposing things.
If what you say is true, the actual implementation shows it's possible to do what I want, so I would just suggest it.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232766 - 21/06/11 01:24 AM Re: $input and dialog [Re: Wims]
drum Offline
Fjord artisan

Registered: 08/12/02
Posts: 339
Originally Posted By: Wims
Quote:
That is exactly what "modal" means, so, yes, you do want to make a modal dialog.
No wink you said "modal dialog", only $input is modal, the dialog is far from being modal


The window that is created as a result of calling $input is called a dialog box. Don't confuse the general term of these types of windows with the more specific "custom dialogs" that can be created with dialog tables in mIRC.

argv0 is saying that you want the $input window (which is a dialog box) to be modal.

Top
#232767 - 21/06/11 02:10 AM Re: $input and dialog [Re: drum]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Ok, well I stated that I wanted a modal $input dialog but $input is always modal.
What would be the point of having a parent window for $input regardless of being modal or not ?
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232777 - 21/06/11 09:24 PM Re: $input and dialog [Re: Wims]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
Originally Posted By: Wims
Ok, well I stated that I wanted a modal $input dialog but $input is always modal.


$input is not always modal. This is the entire premise of this bug post and discussion. Currently, $input is modeless when called from a dialog unless you pass 'u'-- but 'u' should not activate modality (not according to the description of its behaviour, anyway). You should probably re-read the link I sent above that explains what "modal" means, because I'm not sure you're on the same page with what modality is.

The point is that if you're relying on behaviour that is a side-effect of a feature and not the feature itself, we should correct the side-effect. In this case that would mean changing how 'u' activates modal $inputs when called from a custom dialog, and then creating another properly named switch that does only one thing: force a modal $input (or potentially force a modeless $input).

Perhaps that real bug here is that $input is modeless when called from a dialog. This is certainly not the behaviour when called from the editbox of a regular window. Maybe $input should be modal by default, then we don't need to worry about 'u' at all (though adding a switch to make it modeless and fixing 'u' would still be needed).

Originally Posted By: Wims
What would be the point of having a parent window for $input regardless of being modal or not ?


Carefully re-read my last post, as I explained the exact reason why you would want to associate a parent window for a modeless dialog (custom or $input).

And finally, just to clarify-- drum is correct, I was referring to the general UI classification of "dialog windows" (dialogs are a subset of "windows", of which mIRC's dialogs are not the entire subset), not the dialog feature of mIRC. $input is also considered a "dialog".
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#232781 - 22/06/11 12:52 AM Re: $input and dialog [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Quote:
$input is not always modal. This is the entire premise of this bug post and discussion. Currently, $input is modeless when called from a dialog unless you pass 'u'-- but 'u' should not activate modality (not according to the description of its behaviour, anyway). You should probably re-read the link I sent above that explains what "modal" means, because I'm not sure you're on the same page with what modality is.
I know what modal means, I made several tests and they showed that $input is modal in most cases (I thought all cases).
I also didn't say the u switch should activate modality, just that it's what is happening (in most cases and regardless of the u switch) and that I want that behavior avalaible (modal $input).

Quote:
The point is that if you're relying on behaviour that is a side-effect of a feature and not the feature itself, we should correct the side-effect. In this case that would mean changing how 'u' activates modal $inputs when called from a custom dialog, and then creating another properly named switch that does only one thing: force a modal $input (or potentially force a modeless $input).
I agree with this.

Quote:
Carefully re-read my last post[...]
Indeed sorry



Edited by Wims (22/06/11 12:54 AM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#232794 - 22/06/11 07:04 AM Re: $input and dialog [Re: Wims]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
Good, then I think we can agree on maybe one thing:

$input should always be modal by default. Specifically, there seems to be an inconsistency in that $input becomes modeless if activated from a DIALOG event. I think this is really the underlying bug that you're after here-- not the behaviour of the u switch. If $input is modal by default (and u doesn't activate modality) then your script would work as it should-- with or without the u switch.

The only problem I foresee with making such a change is regarding backwards compat. There may actually be a fairly large number of scripts out there that use $inputs from custom dialogs-- not sure how many of those scripts rely on a modeless $input, though. That number may actually be much smaller.

A fair compromise might be adding an extra switch in $input to force the dialog created by $input to always be modal.. let's pick 'z' for now. Using $input(Hello,z) would always yield a modal dialog, whether it's initiated from a channel or from a dialog. A counterpart could be made to create a modeless dialog, say 'c' (not many letters left in $input). An $input(Hello,c) would create a modeless dialog regardless of whether it was created from a channel or dialog. Not sure whether the modeless part is technically feasible from the POV of the event processing queue, though.

In either case (make $input modal by default or add an extra modal switch), the u switch should no longer make the $input modal. It should only do what the help file describes, and that is associate the currently active window as the parent.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#232797 - 22/06/11 01:21 PM Re: $input and dialog [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Yeah, I don't mind the solution used around this or the new switch letter, as long as everything is done properly smile
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top