Page 1 of 1
No-button for user interaction
Posted: 12 Aug 2014 10:45
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"?
Re: No-button for user interaction
Posted: 12 Aug 2014 10:52
by bdeshi
Re: No-button for user interaction
Posted: 12 Aug 2014 11:52
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.
Re: No-button for user interaction
Posted: 12 Aug 2014 13:39
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:
Re: No-button for user interaction
Posted: 12 Aug 2014 15:00
by Stef123
admin wrote: vbOKCancel = 1, vbYesNoCancel = 3, vbYesNo = 4
Thank you. Exactly what I was hoping for.
Your feedback and implementation speed seems to have been raised by yet another notch
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.
Re: No-button for user interaction
Posted: 12 Aug 2014 15:46
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 
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)
Re: No-button for user interaction
Posted: 12 Aug 2014 15:50
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!
Re: No-button for user interaction
Posted: 12 Aug 2014 16:33
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.
Re: No-button for user interaction
Posted: 12 Aug 2014 18:05
by SkyFrontier
Cool.
Will the buttons be translate-able or do they are totally Windows-owned?
Re: No-button for user interaction
Posted: 12 Aug 2014 18:11
by admin
Windows-owned.
Re: No-button for user interaction
Posted: 12 Aug 2014 18:31
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().
Re: No-button for user interaction
Posted: 12 Aug 2014 18:37
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)
Re: No-button for user interaction
Posted: 12 Aug 2014 19:19
by SkyFrontier
echo "You're welcome!<crlf 2>; )";