MessageBox problem
« on: 24 June 2016, 12:00:18 »
Hello again,
I have a problem with the tgui::MessageBox.

I think the problem is with the VisualC++ compiler as it trys to replace MEssageBox with MessageBoxA as it is defined in the macro
#define MessageBox MessageBoxA

Is there a solution for this?

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: MessageBox problem
« Reply #1 on: 24 June 2016, 16:21:01 »
Ideally you would just not include TGUI and windows.h in the same files. But you can just add this after including windows.h:
#undef MessageBox

There isn't much that I could do to prevent this, this is exactly the reason why people should use namespaces and never put defines of common words in a header file.

Re: MessageBox problem
« Reply #2 on: 24 June 2016, 16:43:56 »
Ok, this way it works. Another question:

is it possible to have the messagebox modal?

how to get the button pressed?

Sorry for so many questions, but I have not found an example of how to use this widget.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: MessageBox problem
« Reply #3 on: 24 June 2016, 16:54:50 »
To prevent the things behind the messagebox to be used, you can create a Panel that fills the whole screen before you create the MessageBox. You can give the panel a transparent background color to make it look nice with something like "panel->getRenderer()->setBackgroundColor({0,0,0, 150});"

To get the pressed button you can connect to the ButtonPressed signal. You probably will also have to handle the Closed signal as well (if you connect to it then you have to remove the messagebox yourself).

The tutorials and examples are indeed still lacking, which probably won't improve much until the next tgui version.

Re: MessageBox problem
« Reply #4 on: 24 June 2016, 16:56:06 »
Thank you very much!