Re: [NTLK] NewtonScript question

From: Andrei Chichak (acpmiedm_at_telusplanet.net)
Date: Thu Oct 28 2004 - 10:22:26 PDT


At 10:58 PM 2004-10-26, you wrote:
>It seems, here, I'd need an array of arrays. Is this
>possible in newtonScript?

Of course. An array looks like [1,2,3,4].
An array of arrays looks like [[1,2,3,4],[11,12,13,14],[21,22,23,24]].
Element [1,3] would be 14.

>And to reference the first
>popup, called popUp1, from within the second is it
>just reading popUp1.popup[itemSelected] ?
Not really. Item selected is a parameter of the pickActionScript, not a
slot in the proto. Your pickActionScript could update a slot that popUp2
could then query.

You may be thinking a little bit backwards. When popUp1 has its value
selected, it calls the pickActionScript. Within the script you know what
the values of popUp2 should be set to. So you would do something equivalent to:

func(itemSelected)
begin
         if (itemSelected = 0) then begin
                 popup2.labelCommands := ["fen","gug"];
         end;
         if (itemSelected = 1) then begin
                 popup2.labelCommands := ["fu","bar"];
         end;
         popup2:pickActionScript(0);
         inherited:?pickActionScript(itemSelected); // this method is
defined internally
end

The call to popup2:pickActionScript preloads the screen with the first item
in the array. It will have the side effect of doing whatever the
pickActionScript does when that item is chosen, so it may not be what you
want (or more accurately, when).

BTW, you say that you have a "protoPopupButton", what's that? I don't have
it in my list of standard protos. Is it some sort of custom proto? This may
make your mileage vary depending on the parentage of the proto you are using.

Andrei

-- 
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 : Thu Oct 28 2004 - 11:00:04 PDT