cancel
Showing results for 
Search instead for 
Did you mean: 

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

leon_laikan
Participant
0 Kudos

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")

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

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

leon_laikan
Participant
0 Kudos

Hi Maik

Thanks for your reply. I shall try it tomorrow moning in office.

But just tell me:

The codes I have mentioned are the only ones I used to pop up a Message Box.

If I use your code, how can I know the FormUID of my Message Box?

Best Regards,

Leon

maik_delly
Active Contributor
0 Kudos

Hi Leon,

FormUID is an available variable from ItemEvent eventhandler  ( also possible would be / equal to  pVal.FormUID ).

regards,

Maik

Answers (1)

Answers (1)

edy_simon
Active Contributor
0 Kudos

Hi Leon,

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

  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

leon_laikan
Participant
0 Kudos

Hi Edy

Thanks a lot for the clarification.

Best Regards,

Leon