• 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
Cocoa binding question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa binding question


  • Subject: Cocoa binding question
  • From: Dominic Germain <email@hidden>
  • Date: Mon, 30 May 2005 22:28:24 -0400


Hi,

I'm working to build an app that get data from a MySQL database using Cocoa binding.

Since all my rows in all my tables are identified using unique ID, I want to use this ID number when row in a table is referring to a row in an other table.

Sample db:

masterTable
-----------
id int
somefield1 string
somefield2 string
id_detail ----------------+
                          |
detailTable               |
-----------               |
id int   <----------------+
somefield1 string
somefield2 string



When I try to build a TableView for "mastertable", I try to use a NSPopUpButtonCell for the id_detail column. I set my "content" to the array matching detailTable, I set the "contentValue" to "somefield1". A this point, everything is OK... The Popup lists the expected data. Since I don't want to link my tables using an object address (this is not usefull for saving in MySQL) and I don't want to show the field I want to save, I decide to use the selectedTag way... So I bind my selectedTag to id_detail... But there is a problem... The value of the Tag for each menu item is a self assign zero starting number.

The class I use in my arrays is a home-made class that implement -tag and -setTag and my tags are not loaded by cocoa binding when building PopUpButton...


@interface NSMySQLRow : NSObject { int tag; NSDictionary *data; }

- (int)tag;
- (void)setTag:(int)anInt;

- (NSDictionary*)data;
- (void)setData:(NSDictionary*)aDict;
@end

So, the question, how can I use the selectedTag field in binding... ? Anyone have a simple working example or some interesting docs about that? Apple help is not very complete...

regards

Dominic Germain
---------------------------------------------
Administrateur réseau / Network administrator
Internet Galilée
www.sogetel.net

email@hidden

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


  • Follow-Ups:
    • Re: Cocoa binding question
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Exception raised during posting of notification
  • Next by Date: Re: Why is it like this?
  • Previous by thread: Limit data rate with an NSURLConnection
  • Next by thread: Re: Cocoa binding question
  • Index(es):
    • Date
    • Thread