How to close a modal form?

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

How to close a modal form?

Post by Pablo »

I closed a modal window by hiding it (common.visible=false) and the hidden form continued to be modal so I had to have Windows shut down MM :roll:

What's the correct way of unloading a modal form?
tss

Post by tss »

If you set the button's ModalResult to a value you don't have to provide a click handler and the modal form closes:

Code: Select all

        Set OKBtn = SDB.UI.NewButton(Form) 
        OKBtn.Caption = "&OK" 
        OKBtn.ModalResult = 1

        Set CancelBtn = SDB.UI.NewButton(Form) 
        CancelBtn.Caption = "&Cancel" 
        CancelBtn.ModalResult = 2

        res = Form.ShowModal
        If res = 1 Then
            MsgBox "OK Pressed"
        Else
            MsgBox "Cancel Pressed"
        End If
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

tss wrote:If you set the button's ModalResult to a value you don't have to provide a click handler and the modal form closes:
Thanks! :D
Post Reply