Pages: 1
Author Topic: MessageBox and NoticeBox issue...  (Read 3056 times)

Posts: 14

« on: August 06, 2010, 09:44:21 AM »

[XMetaL Author Version#:]

I would like to display a dialog box with only one button. ('Cancel')

MessageBox does not seem to allow this as 'Ok' is the only single-button option.

NoticeBox, for some strange reason, also does not allow this.  If you do not provide text for 3 buttons, it will always add a second or third button saying 'cancel.'  If you provide no text at all, you get an 'ok' and a 'cancel' button.

Is there a way to have a dialog box with just one 'Cancel' button?

(while the dialog box is open, there is an async xmlhttp request going on that is attempting to connect to a server that requires the user to either be logged in directly or logged in through vpn.  The dialog box informs them that they must be connected and to cancel the request if perhaps they forgot to login.  I do not want any other way for the user to close the dialog box, because the eventual connection and form response inserts an object where their cursor was located--I don't want the user to accidentally click somewhere else and have the insert go in the wrong place.  I suppose I could save the position of the cursor prior to running anything, but the dialog box is also being used in place of a "busy" mouse cursor that I only want to close once the connection is complete or cancelled.) 
Derek Read
Program Manager (XMetaL)

Posts: 2580

« Reply #1 on: August 06, 2010, 12:04:18 PM »

NoticeBox and MessageBox are working as designed. There are no options to display just a Cancel button using either of these APIs.

Alert shows a single button but the text is always "OK" and you cannot change it.

Prompt (the only other type of 'canned' dialog XMetaL provides) is of course not desirable due to the textbox input area.

You can create an XFT dialog using the XFLayout tool provided with XMetaL Developer. XFT dialogs (aka: XFT forms) can have as many or few buttons on them as you like with any text you wish. The buttons can perform any action you can write a script for.

In order to launch your XFT you would use CreateFormDlg() and DoModal(). This initiates the XFT as a modal dialog (which is what you want).

Getting a return value from an XFT is described in this post:,707.0.html

The tricky bit in your case, I think, is that if your xmlhttp request is actually successful I assume you will want to dismiss the form. You should be able to do that by setting the variable created when CreateFormDlg was initially called to a null value. How that would be integrated into your code I'm not sure but it should be a matter of setting null at the right moment.
XMetaL Evangelist

Posts: 116

I even use XMetaL to write my business letters.

« Reply #2 on: August 11, 2010, 02:04:23 PM »

Couldn't you also dismiss the dialog by calling Cancel() on the form object in your script?  (I haven't tried it ... just wondering...)

Tom Magliery
JustSystems Canada, Inc.
Pages: 1
Jump to:  

email us