TGMsgBox Modal and Modaless


_ROOT Version:28.00b
_Platform:Windows
_Compiler:VS2008


I’m supporting an existing application that uses root v28.00b. In some calls to new TGMsgBox() creates a modal dialog, while other calls create a modaless dialog.

I can’t figure out what causes the modal and/or the modaless TGMsgBox creation.

How can you specify the Modal property when calling new TGMsgBox()?

How can you specify the Dialog should not have the minimize/maximize/Close button when calling new TGMsgBox()?

Thank you,
Angel

@bellenot can you help here please?

Hi,

A TGMsgBox should always be modal… In which condition do you see modeless dialog?

Usually by using TGMainFrame::SetMWMHints(), but AFAIK, you can’t customize a TGMsgBox

Cheers, Bertrand.

Bertrand,

Thank you for the response. Very interesting behavior with TGMsgBox().

On the following call, the TGMsgBox() is modaless. I know, because I put a breakpoint on the line, when I hit it, I press next line and I can continue to multiple lines below the call. I have to press continue to get the dialog box to display. At this point, I’m out of the function that makes the below call.

TGMsgBox *pTGmsgBox = new TGMsgBox(gClient->GetRoot(), MainFrame->pMainFrame, GENESIS_NAME2, tStr1.Data(), kMBIconAsterisk, kMBOk | kMBCancel | kMBDelaySweepF, &iRetCode);

On other instances, the moment I press next line in my debugger, the tgmsgbox is displayed and control is back to the application. At this point I have a Modal dialog.

At this point – knowing TGMsgBox should be modal – I look deeper into what the prior developer did in TGMsgBox(). He may have hacked it up.

What would you recommend for displaying a message dialog and having the option to specify?

  1. Modal/Modaless

  2. Display/Not displaying the minimize/maximize/close “X” buttons on top right of dialog

Regards,

Angel

Then how is iRetCode getting its value?

Implement your own version (possibly inheriting from TGMsgBox)…

BTW, the kMBDelaySweepF flag is not coming from ROOT, this is most probably the answer you’re looking for…

You are correct!

Currently reviewing the modified TGMsgBox(). Horrible! Should have created a derived class.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.