Skip to Content

Is it possible to change the Title of a Message Box in SDK?

Hi,

The code below generates the Message Box shown.

Is it possible to change the title of the Message Box from "System Message" to say, "Update SAP" ?

Thanks.

Leon Lai

-------------------------------------

iReturn = SBO_Application.MessageBox("Update is irreversible!" & Environment.NewLine & _

                                                            "Do you want to continue?", 2, "Yes", "No")

Capture.JPG (58.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 30, 2014 at 04:42 PM

    Hi Leon,

    it is possible - you could just catch the form loaded event and change the form to your needs. In ItemEvent Handler

    if (pVal.FormTypeEx == "0" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD && pVal.BeforeAction == false)
    {
        SBO_Application.Forms.Item(FormUID).Title = "My new title";
    }
    

    Of course you should set an indicator that it is you who opened the messagebox.

    Btw there is a really good blog post about using messagbox as a true modal form :

    http://scn.sap.com/community/business-one-sdk/blog/2013/04/04/true-modal-form-with-ui-api

    regards,

    Maik

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 31, 2014 at 01:33 AM

    Hi Leon,

    There is no direct way of giving the title of the system message box.

    @Maik Delly  shows you the work around.

    the tricky part of the workaround is when you catch the form load event, you need to make sure that the form return by the pVal.FormUID is the correct form that you want to change.

    One way is to get the reference of the form, read the message in the form and compare it with your original message.

    If it matches then you can almost certain that this is the form you want to alter.

    Regards

    Edy

    Add comment
    10|10000 characters needed characters exceeded