File:  [NeXTSTEP 3.3 examples] / Examples / DatabaseKit / BarChart / README.rtf
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:58 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fmodern Ohlfs;}
\paperw15100
\paperh12580
\margl120
\margr120
{\colortbl;\red0\green0\blue0;}
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f0\b\i0\ulnone\fs36\fc0\cf0 BARCHART\

\b0\fs28 by Joe Freeman, NeXT Systems Engineer\
\

\b Overview\

\b0 This palette demonstrates how to use your custom UI objects with the DBKit. It illustrates in particular the DBCustomAssociation protocol which allows you to retrieve or set values to your database via a custom view object (here the ChartOfMatrix view). Note that instead of a custom UI object, you can also connect the nib's file owner to an attribute of your DBModule, and create a custom association in this way.\
\

\b Other peculiarities\

\b0 When compiling this example, you'll notice the compiler warnings about conflicting declarations for the methods 
\b maxValue 
\b0 and 
\b minValue
\b0 . This is a known problem, which will be fixed in a future release of NeXTSTEP.
\b \

\b0 \

\b How to use this example
\b0 \
 \

\b Demo
\b0  without DBKit\
1)	Load the 
\b palette 
\b0  and create a 
\b New Application.
\b0 \
2)	Drag a 
\b plotter
\b0  into the 
\b Window.
\b0 \
3)	Drag off a Slider and create a matrix of 
\b Sliders.
\b0 \
4)	Connect  the 
\b matrix
\b0  to the action method 
\b plotFromMatrix 
\b0 of the 
\b plotter
\b0 .\
5)	Go into 
\b Test Interface
\b0  mode.\
6)	Move the sliders and watch the bars move.\
7)	End 
\b Test
\b0  mode.\
8)	Drag two 
\b TextFields
\b0  into the window.\
9)	Connect the 
\b minField 
\b0 and
\b  maxField
\b0  outlets of the 
\b plotter
\b0  to the 
\b TextFields.\

\b0 10)	Go back  into 
\b TestInterface 
\b0 mode.\
11) Move the sliders and watch the values displayed in the textfields.\
\
\

\b Demo
\b0  with DBKit using the OracleDemo.dbmodel supplied in /NextDeveloper/Examples/DatabaseKit/Models\
1)	Load the 
\b palette 
\b0  and create a 
\b New Application.\

\b0 2)	Drag a 
\b plotter
\b0  into the 
\b Window.\

\b0 3)	Drag a 
\b DBModule
\b0  onto the Objects icon of the NIB file.\
4)	Drag a 
\b DBTableView
\b0  into the 
\b Window.\

\b0 5)	Select OracleDemo, Employee in the module inspector. \
6)   Connect the 
\b Employee.name
\b0  and 
\b Employee.job
\b0  to the 
\b DBTableView.\

\b0 7)	Connect 
\b Employee.salary
\b0  to the 
\b plotter
\b0 .\
8)	Connect the
\b  min 
\b0 and 
\b max
\b0  outlets on the 
\b Plotter 
\b0 to two 
\b TextFields
\b0  .
\b \

\b0 9)	Connect  the 
\b Button 
\b0 target  to the DBModule 
\b fetchAllRecords: 
\b0 method.\
10)	Connect 
\b Employee.salary 
\b0 to a 
\b Slider
\b0 .  Set the 
\b Slider 
\b0 min to 4000 and max to 6000 via the IB Inspector panel.\
11)	Connect the 
\b Slider 
\b0 target
\b  
\b0 to the DBModule  
\b takeValueFrom: 
\b0 method.\
12)	Go into 
\b TestInterface
\b0  mode.\
13)	Press the button to fetch all records.\
14)	Select different rows in the table view and watch the colored bar move.\
15)	Move the Slider and watch the colored selected bar move.\
16) Mouse down on one of the bars in the graph and that row will be selected.\
\

\pard\tx1340\tx2680\tx4020\tx5360\tx6720\tx8060\tx9400\tx10740\tx12080\tx13440\b\fc1\cf1 Topics of Interest\

\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\b0\fc1\cf1 Besides showing you how to create a custom palette, this particular example also illustrates the use of the DBCustomAssociation protocol to make your UI object (here the custom view palette) respond to changes in the DBModule and DBFetchGroup. To make your UI object (custom view) respond to this protocol, you'll need to connect it with a DBModule attribute (here Employee.salary).\
 \
See File ChartOfMatrix.m for more details:\
\
@interface Object(DBCustomAssociation)\

\i // Called when DBModule/FetchGroup fetches a batch of new values\

\i0 - associationContentsDidChange:association;\
\

\i // Called when DBFetchGroup selection changes \
//	e.g., when a new record is selected in a TableView\

\i0 - associationSelectionDidChange:association;\
\

\i // Called when a property value changes elsewhere in the DBFetchGroup, \
//	(usually via editing in the UI) \

\i0 - association:association setValue:(DBValue *)value;\
\

\i // Called when the DBFetchGroup needs to get a value,\
//	e.g., when the associated UI object calls takeValueFrom:\

\i0 - association:association getValue:(DBValue *)value;\
@end\

\pard\tx1340\tx2680\tx4020\tx5360\tx6720\tx8060\tx9400\tx10740\tx12080\tx13440\b\fc1\cf1 \

\b0 Last Edited -  Mai Nguyen, 17/ February /1993
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.