[NTLK] ProtoGlance - how to get it to work?
Chris Rupnik
chris.rupnik at gmail.com
Tue Jan 18 14:45:24 PST 2022
Hi Mathias
Thank you for taking the time to look at this for me. Sadly - even your suggestion doesn’t seem to work for me. Whereas the package complies fine - when you actually hit the button on either an einstein newton or emate300 - i get the error -48809 “Sorry a problem has occurred”
I do notice in your listing you have StepDeclare() sections - which are not present in my example. Are these required? If so - how do you add them to a project?
Chris
> On Jan 14, 2022, at 4:33 PM, Matthias Melcher <mm at matthiasm.com> wrote:
>
>
>
>> 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);
>
>
> ----------------------------------------------------------------------
>
> http://newtontalk.net
> http://twitter.com/newtontalk
More information about the NewtonTalk
mailing list