Update the look of all your PowerBuilder message boxes in a few easy steps

One simple way to update your PowerBuilder application is to convert all your message boxes to use the Windows 10 style PowerMessage object from Ultimate Suite for PowerBuilder:


Having to change all message boxes one by one would be too time consuming. You also run the risk of missing some. Instead, what we can do is create a new, overloaded, global function that overrides the built in PowerBuilder MessageBox function.

Before we do this, let's setup PowerMessage.

Make sure you have the Ultimate Suite for PowerBuilder PBL's or PBD's added to your library list.

Next, create a new global variable:

n_cst_powermessage PowerMessage

In the Open event of your main frame window, register your window with PowerMessage:

PowerMessage.of_Register(THIS)

PowerMessage is now setup and ready to be used. Note that at this point, if you like, you call call into PowerMessage directly to display the updated message:

PowerMessage.MessageBox("Title", "Message Text")

But we want to convert all our message boxes so we'll import a new Global Function; You can download it here:

https://powertothebuilder.com/files/messagebox.zip

Unzip the file and import the .srf file into one of your PBL's. You'll see the new MessageBox function appear as a global function. If you want to review the contents of the function, you'll need to right click on it and select Edit Source. PowerBuilder doesn't support overloaded global functions in the Function Painter.

Next, and most important, do a full build of your application.

That's it; run, test, and enjoy!

Don't have Ultimate Suite for PowerBuilder? Download it here: https://www.pbultimatesuite.com/

Comments

Popular posts from this blog

Develop a web browser in PowerBuilder.

PowerBuilder Code Beautifier / Formatter