General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion MessageBox and NoticeBox issue…

  • fjeneau9

    MessageBox and NoticeBox issue…

    Participants 1
    Replies 2
    Last Activity 12 years, 7 months ago

    [XMetaL Author Version#: 6.0.0.122]

    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?

    Note:
    (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.) 

    Reply

    Derek Read

    Reply to: MessageBox and NoticeBox issue…

    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:
    http://forums.xmetal.com/index.php/topic,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.

    Reply

    mag3737

    Reply to: MessageBox and NoticeBox issue…

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

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support