[NTLK] Accessing a NewtonScript data structure question

From: Blake Patterson (blakespot_at_yahoo.com)
Date: Wed Nov 03 2004 - 13:12:43 PST


I am building a little app that is kind of a spec
reference for "vintage computers" for the Newton,
using NTK and NewtonScript. I've got a question about
loading some popups with data in my structures. Any
help appreciated.

I've got an app with two protoPopupButtons - one popup
(buttonMake) selects the "Make" of a computer type,
and once that's selected, that action populates a
second popup (buttonModel) with a list of computer
Models under that make. I have that working. Now I
need to pull details about the "Model" from some
structures I've setup, to populate text fields. I am
having issues getting from the key of the popup data
structure to the specs structure.

I have setup this structure:

DefConst('kPopupArray, [
               {
                       item: "Apple",
                       subpopup: [
                               {
                                       item: "][",
                                       key: 'apple_ii
                               },
                               {
                                       item: "][+",
                                       key:
'apple_iiplus

                               },
                               {
                                       item: "IIe",
                                       key: 'apple_iie
                               }
                       ]
               },
. . .
]);

...and also:

DefConst ('kSpecs,
               {
                       apple_ii: {
                               cpu: "6502",
                               clock: "1.02 MHz",
                               memory: "64K",
                               slots: "8"
                       },
                       apple_iiplus: {
                               cpu: "6502 Plus",
                               clock: "1.02 MHz",
                               memory: "48K",
                               slots: "8"
                       }
               }
);

...and in the pickActionScript of the first popup, I
have the following line that is successfully
populating the 2nd popup:

buttonModel.popup :=
kPopupArray[itemSelected].subpopup;

...but I am now, in the pickActionScript of the 2nd
popup (buttonModel), I am trying to pull the details
from the appropriate kSpec record, as defined above.
I've tried various approached and keep hitting errors.
 Currently I am trying.

I need to, for example, populate a text element that
displays CPU info for the Make + Model computer. So
if "Apple" is chosen for the first popup and "][+" is
chosen for the 2nd - I need to access kSpec's
"apple_iiplus.cpu" data and display it. My difficulty
is going from the two selected items in the popup and
from there sleecting the proper part of kSpec using
the of 'apple_iiplus.

Can anyone help me bridge this gap? If I had this
taken care if, I believe I can complete this first
test app and gain some sense of achievement that will
help me move onward.

Thanks for any help here. Is there a Newton dev forum
somewhere that I might get more focused help?

bp

                
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
 

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/


This archive was generated by hypermail 2.1.5 : Wed Nov 03 2004 - 13:30:00 PST