[MacRuby] #824: Calls to #validateUserInterfaceItem: have no effect
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ The following implementation of #validateUserInterfaceItem: had no effect when added to a window controller {{{ def validateUserInterfaceItem item false end }}} Replacing the above method with a similar implementation of #validateMenuItem:, however, and menu items were disabled as expected. -- Ticket URL: <http://www.macruby.org/trac/ticket/824> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Old description:
The following implementation of #validateUserInterfaceItem: had no effect when added to a window controller
{{{ def validateUserInterfaceItem item false end }}}
Replacing the above method with a similar implementation of #validateMenuItem:, however, and menu items were disabled as expected.
New description: The following implementation of #validateUserInterfaceItem: had no effect when added to a window controller {{{ #!ruby def validateUserInterfaceItem item false end }}} Replacing the above method with a similar implementation of #validateMenuItem:, however, and menu items were disabled as expected. -- Comment(by martinlagardette@…): Would it be possible to provide a reduction of an app that reproduce the problem? Thank you :-) -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:1> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by mred@…): Attached is an minimal Xcode project that reproduces the problem. -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:2> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): Thanks a lot. However, I also forgot to ask, but what version of MacRuby are you using? Also, what exactly is buggy, could you give a little more details, like step-by-step instructions + expected results etc.? Because when I use trunk (aka 0.7), and click on the `Edit` menu, I get: {{{ validateUserInterfaceItem ["MainWindowController.rb", 17] validateUserInterfaceItem ["MainWindowController.rb", 17] validateUserInterfaceItem ["MainWindowController.rb", 17] validateUserInterfaceItem ["MainWindowController.rb", 17] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:3> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by mred@…): Items are supposed to be disabled when #validateUserInterfaceItem: returns false, but when I click on the Edit menu the Cut, Copy, Paste, and Delete items are all enabled. When I enable the #validateMenuItem method those menu items are correctly disabled. I'm running the example on 10.6.4 with MacRuby revision 4403 installed using one of the nightly builds. -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:4> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): Ok now I understand the problem. I managed to workaround the problem by returning `nil` instead of `false`, so you can use that meanwhile :-). I'll keep investigating though. -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:5> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * milestone: MacRuby 0.7 => Comment: I suspect the method is not properly annotated in the bridgesupport file as returning 'B'. -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:6> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): Already checked, it is. In `AppKit.bridgesupport`: {{{ #!xml <method selector='validateUserInterfaceItem:'> <retval type='B'/> </method> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:7> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): I suspect the problem comes from the BridgeSupport file that defines `validateUserInterfaceItem:` as a method to `NSDocument` when it should be a standalone protocol. -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:8> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): I confirm the problem is BridgeSupport. To work around this problem, you can either use `nil` instead of false, or you can use this additional BridgeSupport file that adds support for `validateUserInterfaceItem:` '''NSUserInterfaceValidations.bridgesupport''': {{{ #!xml <?xml version="1.0"?> <!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd"> <signatures version="0.9"> <depends_on path="/System/Library/Frameworks/AppKit.framework"/> <informal_protocol name="NSUserInterfaceValidations"> <method type="B16@0:4@8" selector="validateUserInterfaceItem:"/> </informal_protocol> </signatures> }}} Then in your main.rb, add the `load_bridge_support_file` function call: {{{ #!ruby # [...] $:.unshift File.expand_path("#{root}") # Workaround for #validateUserInterfaceItem: load_bridge_support_file(root.stringByAppendingPathComponent('NSUserInterfaceValidations.bridgesupport')) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:9> MacRuby <http://macruby.org/>
#824: Calls to #validateUserInterfaceItem: have no effect ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: minor | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: | ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.7 Comment: Should be fixed in r4409. -- Ticket URL: <http://www.macruby.org/trac/ticket/824#comment:10> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby