Dialog Close Notification for MenuItems

Posted on
Thu Aug 06, 2020 11:00 am
hannt offline
User avatar
Posts: 84
Joined: Jul 08, 2011
Location: TN USA

Dialog Close Notification for MenuItems

I'm creating a plugin that does not define a device or action. Instead, it just configures an existing device. The configuration interface is implemented as a MenuItem with a ConfigUI in MenuItems.xml. Here's an example from the Plugin Dev Guide:

Code: Select all
    <MenuItem id="menu3">
        <Name>Turn Off Light...</Name>
        <CallbackMethod>turnOffLight</CallbackMethod>
        <ButtonTitle>Turn Off</ButtonTitle>
        <ConfigUI>
            <Field id="targetDevice" type="menu">
                <Label>Light:</Label>
                <List class="self" filter="self.myLightType" method="getDynamicList" />
            </Field>
        </ConfigUI>
    </MenuItem>
Indigo will open a configuration dialog when the user selects the menu item from the Plugin menu. When the user presses the "Execute" button (or "Turn Off" in the example above), the defined callback method is invoked. However, it doesn't appear that anything happens if the user instead presses the "Cancel" button. Is there a Dialog Close Notification method for a MenuItem callback that captures the state of the cancel button? Thanks!

Posted on
Thu Aug 06, 2020 12:24 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Dialog Close Notification for MenuItems

I'm pretty sure that if the user clicks cancel, then your call back method just doesn't get called. Why do you need to know the menu dialog was displayed if the user cancels the call?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Aug 06, 2020 12:56 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Dialog Close Notification for MenuItems

hannt wrote:
Is there a Dialog Close Notification method for a MenuItem callback that captures the state of the cancel button? Thanks!

Currently, menu item callbacks do not have a validate-on-close callback.

Image

Posted on
Thu Aug 06, 2020 2:00 pm
hannt offline
User avatar
Posts: 84
Joined: Jul 08, 2011
Location: TN USA

Re: Dialog Close Notification for MenuItems

FlyingDiver wrote:
Why do you need to know the menu dialog was displayed if the user cancels the call?

As the user is clicking around in the UI, I'm updating a dictionary in the background. When the user presses the "Save" button, that data in the dictionary will get used to update properties on a thermostat. When the user presses the "Cancel" button, I'd like to delete or maybe clear out the dictionary.

As I've thought through this more, I don't think it really matters if I clean up the dictionary. I can just initialize the dictionary the next time the UI is opened.

Thanks for the info guys.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests