No-button for user interaction

Discuss and share scripts and script files...
Post Reply
Stef123

No-button for user interaction

Post by Stef123 »

Feedback is often required as a Yes/No answer. I tried "msg" and "confirm" - but both default to CANCEL - too confusing in the usual Windows convention that implies "neither Yes nor No, just abort and continue where I was last"

How do I turn the Cancel-text on those controls into "No"?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: No-button for user interaction

Post by bdeshi »

Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: No-button for user interaction

Post by PeterH »

But doesn't press 'Escape key' mean 'Cancel', and have the same result as clicking the 'Cancel button'?
Then 'Cancel' (by key) would mean 'No'? I.e. the meaning would not be as clear as for 'Cancel', I think.

admin
Site Admin
Posts: 66259
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: No-button for user interaction

Post by admin »

Stef123 wrote:Feedback is often required as a Yes/No answer. I tried "msg" and "confirm" - but both default to CANCEL - too confusing in the usual Windows convention that implies "neither Yes nor No, just abort and continue where I was last"

How do I turn the Cancel-text on those controls into "No"?
Next beta:

Code: Select all

syntax: confirm(text, [linebreaker="<br>"], [DefaultButton=1], [buttons=1])
Values:
vbOKCancel = 1, vbYesNoCancel = 3, vbYesNo = 4

Example:

Code: Select all

msg confirm("Ok?", , , 4);

Stef123

Re: No-button for user interaction

Post by Stef123 »

admin wrote: vbOKCancel = 1, vbYesNoCancel = 3, vbYesNo = 4
Thank you. Exactly what I was hoping for. :appl:
Your feedback and implementation speed seems to have been raised by yet another notch 8)
PeterH wrote:But doesn't press 'Escape key' mean 'Cancel', and have the same result as clicking the 'Cancel button'?
Correct. And the very reason I was not satisfied with having "Cancel" only.
PeterH wrote:Then 'Cancel' (by key) would mean 'No'? I.e. the meaning would not be as clear as for 'Cancel', I think.
The other way round: the meaning of Cancel is not as clear as No.
Or rather - it's two different things. Open Word, type something, exit Word. It will ask you whether you want to save the changes. NO will exit without saving, but Cancel will cancel the exit-operation and keep you inside Word.

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: No-button for user interaction

Post by PeterH »

Stef123 wrote:
PeterH wrote:Then 'Cancel' (by key) would mean 'No'? I.e. the meaning would not be as clear as for 'Cancel', I think.
The other way round: the meaning of Cancel is not as clear as No.
Or rather - it's two different things. Open Word, type something, exit Word. It will ask you whether you want to save the changes. NO will exit without saving, but Cancel will cancel the exit-operation and keep you inside Word.
I meant it the other other :shock: way round: Esc is the Cancel key. What does it do if selections of Yes and No are available?
(Imagine question: "Skip deleting files? Yes/No" - Esc pressed)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: No-button for user interaction

Post by bdeshi »

I have a similar problem in many scripts, most recently in xyskinner.
At one point the script asks if you want to save before restart or not. Because it's about to restart XY, users might justifiably assume pressing cancel here means cancelling the script/restart.
I had to explicitly describe what Cancel does, creating a larger than necessary messagebox in the process.

This is going to be a very welcome feature.
Thanks Don. Have a nice stay on the comet!
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Stef123

Re: No-button for user interaction

Post by Stef123 »

PeterH wrote:Esc is the Cancel key. What does it do if selections of Yes and No are available?
Hm, I am not so sure about ESC always being equal to Cancel. In dialogs that have two buttons only, I've come to expect ESC to trigger the "other" button that is not focused by default. ENTER being on one end of the "continuum" so to speak, and ESC being on the other.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: No-button for user interaction

Post by SkyFrontier »

Cool.
Will the buttons be translate-able or do they are totally Windows-owned?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66259
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: No-button for user interaction

Post by admin »

Windows-owned.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: No-button for user interaction

Post by SkyFrontier »

Newbies seeing this can resource to a code like:

Code: Select all

   $choice = input("Continue?", "Yes, you can...<crlf>Set 1 for YES-sim<crlf>Set 2 for NO-não<crlf>Set 3 for CANCEL-cancelar", 1, );

   if($choice == 1) {
                    echo "Pressed YES.";
                    }
   if($choice == 2) {
                    echo "Pressed NO.";
                    }
   if($choice == 3) {
                    echo "Pressed CANCEL.";
                    }
-as you can figure, everything can be customized both for echo'es() and input().
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stef123

Re: No-button for user interaction

Post by Stef123 »

Thanks Sky,
very useful indeed, this kind of "recipe modules" for newbies like me. And fun too, leads to results quickly enough to keep you motivated (compared to the somewhat dreary "echo hello world" stuff that always kept me wondering what the heck I'd ever need it for)

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: No-button for user interaction

Post by SkyFrontier »

echo "You're welcome!<crlf 2>; )";
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply