RobotStudio event

GTPUmessage box display not as promised

Options

Hello,

I use a GTPUMessageBox in my application, but it doesn't look as nice as i had hoped. My code is:


Inherits
GTPUMasterDialog
GTPUMessageBox.Show(
Me, Nothing, "message", "caption", Windows.Forms.MessageBoxIcon.Asterisk)

The problem is that both the caption and the icon aren't displayed. Can anyone tell me whats wrong?

 

:) Regards,
Jan-Jaap

Comments

  • RussD
    Options

    Try this snippet, which works for me:


    GTPUMessageBox.Show(
    Me, _

    New MessageBoxEventHandler(AddressOf MBHandler), _

    "Message here... ", _

    "Dialog Title Here", _

    System.Windows.Forms.MessageBoxIcon.Exclamation, _

    System.Windows.Forms.MessageBoxButtons.OK)


    Private
    Sub MBHandler(ByVal sender As System.Object, ByVal e As MessageBoxEventArgs)
    ' do nothing for now
    End SubRussD38697,6285763889
    Russell Drown
  • Hello Russ,

    I tried your suggestion, but it doesn't make much of a difference: no icon, no caption. Does anyone have any ideas?

     

    :) Regards,
    Jan-Jaap
  • When do you show this dialog? If you show it when you get a controller event you must use the Invoke method, otherwise you will get strange UI phenomenas. Urban38700,478599537
    Urban Vikblom
    CONTAB
  • The messagebox is shown in a click event from a button, as a confirmation of the click to the user.

     

    :) Regards,
    Jan-Jaap
  • RussD
    Options

    What version of RW and FPSDK are you using?

    Have you tried every possible icon, and none of them are displayed?

    Is the space where the dialog caption should be displayed shown? This should be a thin blue strip across the top of the MessageBox.

    Does this behavior occur on both the physical GTPU and the Virtual IRC5, or only one of these?

    RussD38700,6507986111
    Russell Drown
  • Hello,

    RW 158, SDK 5.06;

    I tried several;

    Where the caption should be, there is the blue line.

    Both Virtual IRC5 as well as physical.

    :) Regards,
    Jan-Jaap
  • RussD
    Options
    Could you post a screenshot of the GTPUMessageBox you get from the VC, as well as the EXACT code that you used to display that GTPUMessageBox?
    Russell Drown
  • Hello,

    Here is the screenshot. The code is:

                GTPUMessageBox.Show(Me, New MessageBoxEventHandler(AddressOf MBHandler), _
                "Batch afgebroken. Huidige product wordt afgemaakt op beide stations", _
                "Batch afgebroken", Windows.Forms.MessageBoxIcon.Asterisk)

    image

    jan-jaap38700,7192939815
    :) Regards,
    Jan-Jaap
  • RussD
    Options

    The problem you are seeing is that you are not supplying the correct number of parameters in your method call. There is no overloaded version that takes 5 parameters;the closest is

    Show(ByVal owner As System.Windows.Forms.Control, ByVal callback As ABB.Robotics.Tps.Windows.Forms.MessageBoxEventHandler, ByVal text As String, ByVal ParamArray state() As Object)

    This is the version you are actually, in effect, calling. Your 4th and 5th parameters are getting treated as the items in ParamArray, but they are not the expected values, so the dialog is formatted by ignoring what you are passing in for parameters 4 and 5. I am surprised that it doesn't throw an exception because of this. The red "X" apparently is the default icon that is used when a valid value is not specified, and "OK" is the default button that is displayed.

    The simplest thing you can do to fix this is to add a System.Windows.Forms.MessageBoxButtons argument, for instance System.Windows.Forms.MessageBoxButtons.OK, to the code snippet you supplied above. I have tested your code and confirmed that this will fix it, i.e. cause an icon to be displayed AND display the title caption. For example,

    GTPUMessageBox.Show(Me, New MessageBoxEventHandler(AddressOf MBHandler), _
    "Batch afgebroken. Huidige product wordt afgemaakt op beide stations", _
    "Batch afgebroken", Windows.Forms.MessageBoxIcon.Asterisk, _ System.Windows.Forms.MessageBoxButtons.OK)

    Note that you may find that some of the icons will not be displayed as expected. Here are the results I saw when testing each icon type with otherwise identical code.

    System.Windows.Forms.MessageBoxIcon.Asterisk= the blue "i"

    System.Windows.Forms.MessageBoxIcon.Exclamation= the yellow "!"

    System.Windows.Forms.MessageBoxIcon.Hand= the red "X"

    System.Windows.Forms.MessageBoxIcon.None= none

    System.Windows.Forms.MessageBoxIcon.Question = the blue "i"

    In reality, "Hand" is not a good name, it should probably be "Error" or something similar. "Question" is being mis-displayed, as its description in the object browser is "A question mark in a circle". THis appears to be a defect.

    RussD38700,766412037
    Russell Drown