• 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: Can't get NSToolbar to work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't get NSToolbar to work


  • Subject: Re: Can't get NSToolbar to work
  • From: Marco Binder <email@hidden>
  • Date: Fri, 13 Jun 2003 13:45:52 +0200

I dont know the details of the java-implementation of toolbars (are all constructors you use valid?). but why not have a look at /Developer/Examples/Java/AppKit/SimpleToolbar on your HD, which is nothing but an example of how to use NSToolbar in a cocoa Java application.

Greetings,

Marco


Am Freitag, 13.06.03, um 13:23 Uhr (Europe/Berlin) schrieb Markus Hanauska:

I want to thank all people who helped me with my last problem (the multi-Window app); all input from you was really helpful! Thanks a > lot.

Now if someone could tell me why the code below my signature doesn't work, you could make me very happy again :-)


window is connected, don't worry about that. Everything works fine if I don't return a NSArray from toolbarDefaultItemIdentifiers and toolbarAllowedItemIdentifiers, but null as result.

This is of course just a stupid test program, not code from my real app.

The error looks like that (no error during compile time, but it fails to run):

2003-06-13 13:11:53.252 NSToolbarTest[1338] *** -[NSToolbarItem isEqualToString:]: selector not recognized
2003-06-13 13:11:53.265 NSToolbarTest[1338] AppKitJava: uncaught exception NSInvalidArgumentException (*** -[NSToolbarItem isEqualToString:]: selector not recognized)
2003-06-13 13:11:53.267 NSToolbarTest[1338] AppKitJava: exception = NSInvalidArgumentException: *** -[NSToolbarItem isEqualToString:]: selector not recognized
Stack Trace:
NSInvalidArgumentException: *** -[NSToolbarItem isEqualToString:]: selector not recognized
at com.apple.cocoa.application.NSWindow.setToolbar(Native Method)
at Toolbar.awakeFromNib(Toolbar.java:28)
2003-06-13 13:11:53.332 NSToolbarTest[1338] AppKitJava: terminating.

NSToolbarTest has exited with status 1.


A C++ program, almost identical in function (just that it uses an NSDictionary instead of a simple array to hold the items) works without any problems. I just don't know about which selector the app is complaining here and what isEqualToString has to do with it.

--
Best Regards,
Markus Hanauska


/* Toolbar */

import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;

public class Toolbar extends NSObject implements NSToolbar.Delegate {

public NSWindow window; /* IBOutlet */

private NSToolbarItem[] items;

public void awakeFromNib() {
NSToolbar bar = new NSToolbar("test");
bar.setDelegate(this);

NSSelector action =
new NSSelector("click",
new Class[] {NSToolbarItem.class});

items = new NSToolbarItem[100];
for (int i = 0; i < 100; i++) {
items[i] = new NSToolbarItem("" + i);
items[i].setLabel("Item " + i);
items[i].setTarget(this);
items[i].setAction(action);
}

window.setToolbar(bar);
}


public NSToolbarItem toolbarItemForItemIdentifier(NSToolbar bar,
String id, boolean bool) {
int i = Integer.parseInt(id);
return items[i];
}

public NSArray toolbarDefaultItemIdentifiers(NSToolbar bar) {
return new NSArray(items);
}

public NSArray toolbarAllowedItemIdentifiers(NSToolbar bar) {
return new NSArray(items);
}

public void click(NSToolbarItem i) {
System.out.println("Click on " + i.label());
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


--
|\ /| email@hidden http://www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Can't get NSToolbar to work
      • From: Markus Hanauska <email@hidden>
References: 
 >Can't get NSToolbar to work (From: Markus Hanauska <email@hidden>)

  • Prev by Date: Can't get NSToolbar to work
  • Next by Date: Re: Can't get NSToolbar to work
  • Previous by thread: Can't get NSToolbar to work
  • Next by thread: Re: Can't get NSToolbar to work
  • Index(es):
    • Date
    • Thread