Surely others have faced this issue before? Does anyone know of a free or
at least affordable and royalty-free solution for it?
I want the advantages of a MessageBox, like it auto-sizing itself to see
all of the desired text without scrolling, and a simple API for icons,
buttons etc. That's why a solution like embedding a WebBrowser control in a
window doesn't seem adequate to me - I am very dubious there is a way to
get it to autosize to the right size. And I don't want to do the heavy
Windows API programming to create the fonts myself, determine display
lengths of strings, etc. - that's why I want to find an existing solution.
Also, in terms of the basic font size in the MessageBox, I know there is a
way to change that in Control Panel. But I can't tell all of my users to do
that, since it would affect all of their programs.
Thanks.
> I have a commercial GUI app written in PowerBuilder. Sometimes my
> MessageBox messages get a bit long, because I have a lot to tell the
> user, or a complicated question to ask them. Such MessageBoxes could
> benefit from a larger font and some emphasis such as bold etc. The
> most obvious way to do that would be with a MessageBox replacement
> that accepted HTML (or, less optimally, RTF).
>
> Surely others have faced this issue before? Does anyone know of a free
> or at least affordable and royalty-free solution for it?
OK, I think I actually found a solution myself. I thought I had Googled
this thoroughly before, but I tried again after posting this question,
and found a product called QHTM, which describes itself as an ultra-small
Win32 HTML control that doesn't depend on IE. Among other things, it
contains an HTML messagebox function that is a direct replacement for the
regular MessageBox API. Initial tests indicate it will work with
PowerBuilder.
You can find it at http://www.gipsysoft.com/qhtm/
The external function declarations are:
Function Long QHTM_Initialize(Long hInstance) Library "qhtm.dll"
Function Long QHTM_MessageBox(Long hWnd, String Text, String Caption,
Long uType) Library "qhtm.dll" alias for "QHTM_MessageBox;Ansi"
You need to call QHTM_Initialize once in the application, as:
QHTM_Initialize(Handle(GetApplication()))
Then you can call QHTM_MessageBox as desired. It has exactly the same API
as the normal Windows API MessageBox, except for allowing HTML in the
text argument. So, a simple sample call might be:
QHTM_MessageBox(0, "This messagebox has <b>bold</b> and <i>italic</i>!",
"DONATION", 0)
Of course, one might want to write some code to cover this and allow it
to be called more like the PowerBuilder MessageBox function is called.
> I don't know if this is what you have in mind, but there is
> a good Hoyt Nelson article in the November 2006 issue of the
> PowerBuilder Developer's Journal where he describes how to
> override the MessageBox() function with one of your own
> creation.
I remember seeing that, but I'm quite sure it doesn't have anything in it
to help you display HTML in the messagebox.
How about embedding a Windows Internet Explorer component?
I'm sorry, I take it back - I cannot recommend this component. At first it
seemed to work, but then it randomly failed, with PB telling me it couldn't
find the methods.
I think the company is out of business - the only contact method on the
form is a "contact me" web form, and I sent a couple of questions on it
over 2 weeks ago, and have received no response. And the latest version of
the software on the site is a few years old.
---------------------------
Dan Cooperstock
DONATION web site: http://www.Software4Nonprofits.com
DONATION Support forums: http://forums.Software4Nonprofits.com
Email: mailto:in...@Software4Nonprofits.com
Phone: 416-423-7722
> How about embedding a Windows Internet Explorer component?
As I mentioned in my post that started this thread, that has many
disadvantages in comparison to a real messagebox, most particularly that
there is no way to get it to auto-size to the exact size of your message,
so either there may be blank space in it, or the user may have to scroll to
see your whole message.
> I have a commercial GUI app written in PowerBuilder. Sometimes my
> MessageBox messages get a bit long, because I have a lot to tell the
> user, or a complicated question to ask them. Such MessageBoxes could
> benefit from a larger font and some emphasis such as bold etc. The
> most obvious way to do that would be with a MessageBox replacement
> that accepted HTML (or, less optimally, RTF).
OK, I actually ended up creating a full solution for this. My business
Cooperstock software has recently launched the HTML Messagebox product,
at www.HTML-MessageBox.com. It�s an exact replacement for the standard
Windows API MessageBox function, that lets you make your Windows
application's message boxes more readable and usable by setting a larger
default font, then using simple HTML to add emphasis such as boldface,
italics, underline and mixed fonts to the text of your messages. It
includes interfaces for standard Windows API calling, a COM wrapper, and
a .NET class wrapper.
And, best of all for this newsgroup, it also includes a PB NVO that more
or less replicates the standard PowerBuilder MessageBox function. (The
oly difference is that in my app, I always use the same title bar for all
messageboxes, namely the name of my app, so I left the title argument out
of the various functions. You set it by setting an instance variable on
the NVO. But you could easily change that if you wanted to!)