Show native message box

Is there any builtin native method for showing Messagebox crossplatform?

I’ve seen this:
bool ShowMessageBox (Platform::String^ title,Platform::String^ message)

Don’t know it is something like this:
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/pop-ups/Images/alert1.png

Is it possible or I have to build this class myself?

Thank you for help

You can use MessageBox("my message", "title");

2 Likes

Thank you very much.

I didn’t found this neither in wiki, api and guide :frowning:

Just for completeness, is there something builtin also for confirm dialog? (yes/no)
Thank you.

These type of messages or alerts are called roster messages i think.
these things are there in respective OS SDK’s i believe…

but @stevetranby is MessageBox() present in the cocos api… !!
and could you sight a simple example of how to use it… !!

That would help… :smile:

There is no prompt in the engine. You can see the code in the ./cocos/platform/CCCommon.h and associated implementations are in each folder: CCCommon-ios.mm, CCCommon-mac.mm, CCCommon-android.java. Looks like linux is not supported yet. You could probably duplicate it into a prompt (two button) version, except that the callback will be more work and a little tricky. I’ve done this prompt for testing iAP in iOS/Mac/Android, but it’s not in a nice format like plugin-x will hopefully do in the future.

// declaration
void CC_DLL MessageBox(const char * msg, const char * title);
// usage (it's in global namespace)
MessageBox("Congrats on completing the game!", "Victory");
1 Like

thanks @stevetranby :smile:

I though this thing can only be done by calling from the wrapper class to the SDK.
but thankfully, cocos2d-x has something already.

Strange that it is not in the api…
may be i can ask jason to look into it… or may be it is not added intentionally or something… :smile:
anyway thanks again… :smile:

Maybe someone would want to extend the source I provided to include Windows/Phone/Linux/Mac? And once that is done it can get rolled in to Cocos core. :smile:

2 Likes

It will be very good if it will be inserted in Cocos core! :smiley:

I agree. This should definitely be in a cross platform suite.