[NTLK] ProtoGlance - how to get it to work?
Matthias Melcher
mm at matthiasm.com
Fri Jan 14 13:33:32 PST 2022
> On 14. Jan 2022, at 20:49, Chris Rupnik <chris.rupnik at gmail.com> wrote:
>
> Hi
> I am having some difficulty understanding how to implement the protoglance
>
> The newton programmer reference guide 2.0 offers this snippet of code to implement
If your protoGlance is in the same view as your parent, you can call
self:Parent().test:Open();
in the buttonClickScript. It worked for me.
> How can you easily enter in the example code above into a project? perhaps that is the part that i am missing. Whereas the code compiles fine without error - execution on the newton fails naturally when you push the button - an error occurs.
In NTK? Open the Layout view, click into the window and choose protoGlance from the pulldown menu. Then click inside the window and drag open a rectangle. You can then edit it by double clicking it. Or you use Einstein Toolkit:
//
// NewtonScript example: Hello, World!
//
kAppName := "Hello:WONKO";
kAppSymbol := '|Hello:WONKO|;
kAppLabel := "Hello";
newt.theForm := {
viewBounds: {
left: 0, top: 50, right: 200, bottom: 120
},
_proto: protoFloatNGo
};
test := {
text: "Soso",
viewBounds: {
left: 50, top: 170, right: 150, bottom: 200
},
_proto: protoGlance
};
AddStepForm( newt.theForm, test);
StepDeclare( newt.theForm, test, 'test);
helloButton := {
text: "Say Hello",
viewBounds: {
left: 50, top: 25, right: 150, bottom: 50
},
buttonClickScript: func()
begin
self:Parent().test:Open();
end,
_proto: protoTextButton
};
AddStepForm( newt.theForm, helloButton);
StepDeclare( newt.theForm, helloButton, 'helloButton);
More information about the NewtonTalk
mailing list