RTResultListSource


Inherits From:
NSObject
Conforms To:
RTSQLDataSource
NSCoding
Declared In:
RTResultListSource.h


Class Description

This data source for a NSPopUpButton[Cell] has a query associated with it, and populates the popup with the results of the query. The query should return at least one column, which is used to populate the menu. If a second column exists, the matching value for that column can be retrieved by calling valueOfSelectedItem.

This is best used where you need to display a certain value, but you want the value of another column (say a integer primary key) to use.


Method Types

+ resultListSourceForPopUp:
- initWithCoder:
- popUp
- setPopUp:
- session
- setSession:
- queryString
- setQueryString:
- setQueryStringNoExecute:
- databaseName
- setDatabaseName:
- database
- setDatabase:
- noSelectionTitle
- setNoSelectionTitle:
- performQuery:
- resultDisplayTitles
- resultValues
- valueOfSelectedItem
- valueAtIndex:
- selectItemWithValue:
- displayedItemforValue:
returns the index to that should be selected in the popup for a second column value of value
- indexForValue:
- valueTypeConstant


Class Methods

resultListSourceForPopUp:

+ (RTResultListSource *)resultListSourceForPopUp:(id)popUp

Returns the RTResultListSource's that is managing the specified popUp.


Instance Methods

database

- (id <RTSQLDatabase>)database

Returns the database queried. This or the database name must be specified. If not, the first database in the session will be used.


databaseName

- (NSString*)databaseName

Returns the name of the database queried. This or the database must be specified. If not, the first database in the session will be used.


displayedItemforValue:

- (id)displayedItemforValue:(id)value

returns the value (first column of result set) for the row with a second column value of value


indexForValue:

- (int)indexForValue:(id)value

returns the index to that should be selected in the popup for a second column value of value


initWithCoder:

- (id)initWithCoder:(NSCoder*)coder

Initializer used when unarchving from a nib.


noSelectionTitle

- (NSString*)noSelectionTitle

Returns the value displayed in the NSPopUpButton[Cell] that corresponds with a NULL value. If NULL, then NULL values are not allowed.


performQuery:

- (IBAction)performQuery:(id)sender

Executes the specified query and updates the values in the associated popup button. The sender is ignored.


popUp

- (id)popUp

Returns the NSPopUpButton[Cell] being managed.


queryString

- (NSString*)queryString

Returns the query string used to fetch data.


resultDisplayTitles

- (NSArray*)resultDisplayTitles

Returns array of titles to display in a popup. Suitable for binding to NSPopUpButton's content biding.


resultValues

- (NSArray*)resultValues

Returns array of values matching -displayTitles. Suitable for binding to NSPopUpButton's contentValues biding.


selectItemWithValue:

- (void)selectItemWithValue:(id)value

Sets the popup's selection based on a value instead of a title.


session

- (id <RTSQLSession>)session

Returns the active session being used.


setDatabase:

- (void)setDatabase:(id <RTSQLDatabase>)inDatabase

Sets the database queried. This or the database name must be specified. If not, the first database in the session will be used.


setDatabaseName:

- (void)setDatabaseName:(NSString*)inName

Sets the name of the database queried. This or the database must be specified. If not, the first database in the session will be used.


setNoSelectionTitle:

- (void)setNoSelectionTitle:(NSString*)title

No method description.


setPopUp:

- (void)setPopUp:(id)button

Sets the NSPopUpButton[Cell] being managed. If button is a NSTableColumn with a dataCell that is a NSPopUpButtonCell, the data cell will be used as the popup.


setQueryString:

- (void)setQueryString:(NSString*)inQuery

Sets the query string used to fetch data.


setQueryStringNoExecute:

- (void)setQueryStringNoExecute:(NSString*)inQuery

Variant of setQueryString: used by Interface Builder that does not execute the query.


setSession:

- (void)setSession:(id <RTSQLSession>)inSession

Sets the active session being used.


valueAtIndex:

- (id)valueAtIndex:(int)index

returns the value (second column of result set) for the specified index


valueOfSelectedItem

- (id)valueOfSelectedItem

Returns the value (second column of result set) for the popup's selected index.


valueTypeConstant

- (UInt32)valueTypeConstant

Returns the type constant for values


Copyright ©2006 by Runtime Labs, Inc.. All Rights Reserved.