• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Prevent C++ plugin dialog from closing when user presses Escape

Contributor ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

Hi,

 

I have a requirement to prevent the dialog from closing (in one specific use case) when the user presses Escape key on Windows and it's equivalent in Mac.

 

I would like to know if it is possible and how to do it. I have looked at code in CDialogObserver in the SDK files and it appears to handle OK and Cancel only.

 

Please advice.

Thanks,

TOPICS
How to , SDK

Views

213

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

Hi,

 

My first thought would be why, this is standard practice for almost all dialogs in windows or osx to be dismissed by using the Escape key, so it has to be a very good reason to change what the user would be expecting to happen.

 

I would need to spend some time to investigate but I get the feeling that this is the behaviour that is default so would have to investigate if that could be overwridden.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

Hi,

 

I agree with your though process. Unfortunately, this is a soap opera situation for us.

 

The use case for us is like so:

 

1. We have a modal native dialog in our plugin. On click of a button, we are launching our custom extension (manifest is set to MODALDIALOG)

2. This causes the extension browser window to be shown on top of the underneath native dialog.

3. We are able to use this extension window to interact with the destination website in the extension browser using keyboard and mouse

4. However, it appears that the underneath native dialog still is clickable/selectable while the extension browser window is up. In summary, it is possible to interact both with the native modal dialog and the extension modal dialog.

5. We have disabled the dialog so the user can't click on the OK, Cancel button on this native dialog

6. Escape key is one such key that appears to be still processed by a disabled dialog, and that closes the dialog

7. Now, we are on a slippery slope, as the extension window is still open but the dialog from which it was launched is gone. 

8. This causes crash to happen once the extension window is closed.

 

There could be several ways to address this:

1. Make the extension window truly the topmost window over the underneath native dialog, so that user can't even interact with that and Escape button goes to the extension window.

2. If that can't be done, then disable the underneath dialog to process any key/mouse until the extension window is closed

3. If that can't be done, then disable Escape functionality of dismissing the dialog

4. ...

 

Hope it helps clarify the situation. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

HI,

 

Yeah, ok, erm, putting thinking cap on.  taking thinking cap off. looking for something ........ and found nothing.

 

The only thing I can think is to find something else to attach your dialogs to, so that you create a flow something like :

1. open modal dialog (native)

2. User clicks part that shows your browser dialog

3. This click closes your native and then opens the browser (hence only 1 is shown)

4. possibly, on closing of you browser dialog, reopen the native dialog.

 

But I am not sure how you would manage that , if I get time I will take a look.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

LATEST

Hi,

Yes, that's certainly a possibility. Thanks for looking into it.

Regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines