RobotStudio event

Custom Buttons on GTPUMessageBox

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

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 Casas