Custom Buttons on GTPUMessageBox
ycasas
✭
Hello all,
I would like to show a message box containing buttons with custom text (not OK, Cancel, Yes, No). This is possible with some of the overloaded methods of GTPUMessageBox.Show, but I don't know how to handle the click event of the custom buttons.
Can anyone show me how to do it? Some code snippets, maybe?
Thank you,
Yolanda Casas
0
Comments
-
Hello again,
Finally I found the way to make it work... I will post some sample code in case it can be of use to anyone else:
GTPUMessageBox.Show(this, new MessageBoxEventHandler(HandleSelectionResult), "Please chose A or B:", "Select option", ABB.Robotics.Tps.Drawing.TpsIcon.Info, new string[] {"A", "B"});
void HandleSelectionResult(object sender, MessageBoxEventArgs e)
{
if (e.ButtonText.Trim().CompareTo("A") == 0)
{
// Do stuff corresponding to A
}
else if (e.ButtonText.Trim().CompareTo("B") == 0)
{
// Do stuff corresponding to B
}
}
*Note the "Trim()" operation on e.ButtonText before the comparation!!
Regards,Yolanda Casas0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings