/*
Copyright (c) 2019 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
*/
#include <ProToolkit.h>
#include <ProMessage.h>
#include <ProUIMessage.h>
#include <ProArray.h>
/*====================================================================*\
FUNCTION: UserDisplayPopupConfirmation
PURPOSE: Display a hardcoded confirmation message and handle user's choice.
\*====================================================================*/
ProError UserDisplayPopupConfirmation ()
{
ProUIMessageButton* buttons;
ProUIMessageButton user_choice;
/*--------------------------------------------------------------------*\
Setup array of choices to display in the popup dialog.
\*--------------------------------------------------------------------*/
ProArrayAlloc (2, sizeof (ProUIMessageButton),
1, (ProArray*)&buttons);
buttons [0] = PRO_UI_MESSAGE_YES;
buttons [1] = PRO_UI_MESSAGE_NO;
ProUIMessageDialogDisplay (PROUIMESSAGE_QUESTION,
L"Confirmation",
L"Do you really want to delete the feature?",
buttons,
PRO_UI_MESSAGE_YES,
&user_choice);
ProArrayFree ((ProArray*)&buttons);
if (user_choice == PRO_UI_MESSAGE_YES)
{
/*--------------------------------------------------------------------*\
Confirmed. Continue with action.
\*--------------------------------------------------------------------*/
;
}
else if (user_choice == PRO_UI_MESSAGE_NO)
{
/*--------------------------------------------------------------------*\
Denied. Cancel action;
\*--------------------------------------------------------------------*/
;
}
return PRO_TK_NO_ERROR;
}
/*====================================================================*\
FUNCTION: UserDisplayPopupTranslatedWarning
PURPOSE: Display a translated warning message in a popup dialog.
\*====================================================================*/
ProError UserDisplayPopupTranslatedWarning ()
{
ProLine message;
ProUIMessageButton* buttons;
ProUIMessageButton user_choice;
/*--------------------------------------------------------------------*\
Obtain the message text from the message file into the message variable.
\*--------------------------------------------------------------------*/
ProMessageToBuffer (message,
L"msg_ugui.txt",
"USER Warning: value exceeded specified range of 0 - 100");
ProArrayAlloc (1, sizeof (ProUIMessageButton),
1, (ProArray*)&buttons);
buttons [0] = PRO_UI_MESSAGE_OK;
/*--------------------------------------------------------------------*\
Display the popup dialog.
\*--------------------------------------------------------------------*/
ProUIMessageDialogDisplay (PROUIMESSAGE_WARNING,
L"Warning",
message,
buttons,
PRO_UI_MESSAGE_OK,
&user_choice);
ProArrayFree ((ProArray*)&buttons);
return PRO_TK_NO_ERROR;
}
/*====================================================================*\
FUNCTION: UserDisplayMessageDialogs
PURPOSE: Display message dialogs
\*====================================================================*/
ProError UserDisplayMessageDialogs()
{
UserDisplayPopupConfirmation();
UserDisplayPopupTranslatedWarning();
return PRO_TK_NO_ERROR;
}