Re: [NTLK] Help with Newtonscript

From: Daedalus (daedalus_at_digitalinkwell.net)
Date: Thu Jun 05 2003 - 07:46:34 PDT


>Okay, let's just say that I'm not the most accomplished programmer here on
>the board, but . . . I'm starting to be. Or at least I will, once I get some
>help with how to pass variables to linked subviews. It's got me totally
>stumped, can't figure it out. I'm trying to open a protoFloatNGo that is a
>linked subview to my main app. I want to change the protoStaticText on the
>floatNGo to a variable declared in my main app. But, I can't do it, I can't
>seem to use GetVariable to do it, I even thought, hey, why shouldn't I just
>give up. And I will, if I can't get any help with this.

I've never used a protoFloatNGo, so my comments might be irrelevant to
what you're trying to do or come off as a more hackish way of doing
things, but I've found it pretty simple.

1. Make a new clView layout for your subview, add it to your project,
and make it a linked subview to your main app. You *won't* be able to
declare it to your base app, but don't worry about it.

2. I'm using mine as a window for instructions, so I've called mine
textHelp. In your base app, in NTK you should have "linkedSubview:
textHelp" over in the upper left box.

3. To access it from your base application you use something like:
textHelp:open();

4. To add text instructions (in my case) to the linked subview you can
just do something like:

SetValue (textHelp.helpText, 'text, currentText);

where helpText is the protoStaticText in the subview, and 'text is the
text slot in that. currentText is where I can assign whatever text I
need at a particular moment (depending on which instructions need to be
shown at any particular time). I have all of the text I need to show
defined in my project's main text file as constants, and I just call them
up from there depending on which instructions I need to show. For
example, in my text file I have:

constant kHelp1 := "These are the first instructions.";

constant kHelp2 := "These are the second instructions."; (etc.)

So if I need to show kHelp2, I'd do like:

currentText:= kHelp2;
textHelp:open();
SetValue (textHelp.helpText, 'text, currentText);

And the floating layout will appear with the text "These are the second
instructions." (or whatever the actual instructions happen to be).

Just one way of doing it--perhaps not the best, but it definitely works!

Daedalus
http://www.digitalinkwell.net/

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
List FAQ/Etiquette/Terms: http://www.newtontalk.net/faq.html
Official Newton FAQ: http://www.chuma.org/newton/faq/


This archive was generated by hypermail 2.1.5 : Fri Jun 06 2003 - 08:25:16 PDT