• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: set menu item's state
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set menu item's state


  • Subject: Re: set menu item's state
  • From: phil03 <email@hidden>
  • Date: Tue, 18 Mar 2014 23:29:33 +0700

Oops, Mea culpa. I missed the trailing 'then' out of the first line in the pseudo-code, but that's not the problem. It's there in the real code, and indeed the script compiles and runs. It just doesn't update the status of the menu item.


On 18/03/2014 23:23, phil03 wrote:

(Building on Xcode 5.1, OSX 10.9.2; deployment target = 10.9)
Here's some pseudo-code for an action method that's called by a menu bar menu item with the intent of simply toggling a property:

on menuItemCall_(sender)
    if sender's state() = 1 --'on'
        set sender's state to 0 --'off'
        set my someProperty to "no value"
    else
        set sender's state to 1 -- 'on'
        set my someProperty to "yes value"
    end if
end menuItemCall

This code does what I want it to - toggle a property on and off.

However, the problem is the menu in the GUI remains in the same visual state as it was before the call (i.e., if it was 'ticked' it's still ticked even after its state is set to 0. I logged it and checked that it was in fact 0 too, but the ticked state is still seen by the user in the menu list. Likewise if it wasn't ticked and then toggled, it changed values in my properties accordingly but visually remained the same).

How do I get the GUI to update the state of the menu list item? (BTW, I tried doing this by binding it to a Value & Model Key Path and checking 'Validates Immediately' but that didn't work either).


TIA for any help

Best

P


_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: set menu item's state
      • From: phil03 <email@hidden>
References: 
 >set menu item's state (From: phil03 <email@hidden>)

  • Prev by Date: set menu item's state
  • Next by Date: Re: set menu item's state
  • Previous by thread: set menu item's state
  • Next by thread: Re: set menu item's state
  • Index(es):
    • Date
    • Thread