7. NS BASIC Tech Note                                     Aug 14, 1994

How to put a picture in your Names slot                
--------------------------------------------------------------------------

Here's a neat hack in NS BASIC. It puts a PICT into the Notes slot of 
the Names app. Now, when you beam your business card, you can have a
custom designed picture, or perhaps your company logo.

Note: To do this, you'll need the NTK, either the live or demo version.
NS BASIC isn't strictly needed, but makes it easy.

Here's the program:

0010 REM put a picture into notes
0020 open ch,"Names",sortOn
0030 get ch,n,"Henne"
0040 LET n.notes=getroot().|txtxfer:NSBASIC|._proto.stepchildren[13]
0050 put ch,n

How to:

1. Create your graphic in some sort of drawing program. I used
HyperCard.

2. Using ResEdit, cut and paste the graphic into a resource file that's
included in a project in NTK. Mine was called |txtxfer:NSBASIC|. 

Make sure you've named the resource in ResEdit ("NSBASIC", in this
example)

3. In the project, define a clPictureView. Set the value of the icon
slot to your named resource, and download it. Here's how the complete
clPictureView frame should look:
 {viewFlags: 513,
    icon: GetPictAsBits("NSBASIC", nil),
    viewFormat: 1,
    viewBounds: {top: 2, left: 2, right: 239, bottom: 135},
    viewclass: 76
 };

4. Now, look at the stepchildren slots of your app. You can do this in
NS BASIC by typing

0010 LET x=getroot().|txtxfer:NSBASIC|._proto.stepchildren
RUN
VARS

See which element of stepChildren is your clPictureView. Mine was 13.

5. Modify line 40 of the above program to name your application and
address the correct element of stepChildren.

6. Modify line 30 to get your own card in Names

7. Run it!

NS BASIC has gotta be one of the neatest hacking tools around for the
Newton (along with ViewFrame!)

[My thanks to Sidney Low, who first figured out how to do this]