Preventing a DzBasicDialog from executing when Return/Enter is pressed

Hello,

I have a small script I am working on that requires the entry/modification of a few numerial values before 'executing the rest of the script' when the Accept button is pressed. When entering numbers in the script/dialog, out of pure bad habit of couse, I tend to press the Return/Enter key to 'confirm' the entered value for a parameter. This silly action is interpreted by the dialog to run whetever is in the if( wDlg.exec() ) { } code block. Is there a way to filter/disable keypresses in the scripting language? I have moved the 'focus' away from the 'Accept' button.

Thanks!

AMZs

Comments

  • Richard HaseltineRichard Haseltine Posts: 101,469
    edited November 18

    Have you tried adding a dummy button and then using setDefaultButton with it? Or even setHelpButtonAsDefault() and have it popm up an alert?

    Post edited by Richard Haseltine on
  • amzsamzs Posts: 1

    Thank you for the quick response and tips. I have tried the help button idea first, and although it does the 'trick', it leaves the cursor (and mode) corresponding to the help mode, which needs to be bailed out of and can be confusing for a user. However, by creating a dummy button with some text on it (name of script and version) and making it the default button that actually does nothing, that does the trick! :)

    Thanks again for the tips!

    AMZs

Sign In or Register to comment.