Skip to content

Instantly share code, notes, and snippets.

@lukpazera
Created October 27, 2015 08:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukpazera/835219d2587b38bf3a58 to your computer and use it in GitHub Desktop.
Save lukpazera/835219d2587b38bf3a58 to your computer and use it in GitHub Desktop.
How to open a Yes/No dialog using dialog service (MODO SDK).
/* This snippet demonstrates a function that will open a Yes/No dialog in MODO using dialog service.
*
* To create a dialog we need dialog service. We use dialog service to allocate message object
* that will determine the type of dialog that we will open and will contain the text of the message
* that we want to display. The text needs to be set in the message table in a config file.
* Next we set message object to our message passing message table name and message key
* and we use SetCode() method to set the type of a dialog that we want to open.
* Finally, we open such prepared message via dialog service
* and translate the result into boolean value.
*/
bool openYesNoDialog()
{
CLxUser_StdDialogService dialogSrv;
CLxUser_Message msg;
dialogSrv.MessageAllocate( msg );
msg.SetMessage ( "messageTableName", "messageKey", 0 );
msg.SetCode( LXeMSGDIALOG_AS_YESNO );
LxResult result = dialogSrv.MessageOpen(msg, "@messageTableName@messageKey@", NULL, NULL);
return ( result == LXeMSGDIALOG_YES ) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment