Re: [NTLK] Help with programming

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Fri Jul 25 2003 - 22:30:15 PDT


Il me semble que le 25/07/03 23:44 -0500, Michael Burks nous racontait:
>1. Is it possible for me to change a protoPictureButton from one
>picture to another when a user clicks the button? And if it is possible,
>could someone give me a quick "How-To"

You mean user will click and then you change or you want a push
button effect with the picture?

In the first case, the question is just: how do I programmatically
change the picture of an object based on protoPictureButton.

And the answer is: changing the icon slot and then call RedoChildren
does the trick.

Now, for changing when the button is being pressed (i.e. while you
hold the pen, instead of system's default hilite) is a little bit
more tricky. I would suggest to not go protoPictureButton but instead
use a clPictureView you have access to.

The rational is that (I think) protoPictureButton is itself a complex
structure. That's why RedoChildren does the trick: it's made of the
frame and the picture.

So, you'll change the picture of this clPictureView in the
viewClickScript method. Then you'll ask the picture to redraw itself
by dirting it. NewtonOS normally only redraw stuff at the end of the
event loop. There is a trick to force it to do it. Check the Q&As:
http://www.unna.org/unna/apple/documentation/developer/QAs-2.x/html/lockrefr.htm

>2. I understand how to hilite a button viewName:hilite(), but when I
>try to change the hilite from one button to another (by calling hilite()
>twice, once to turn off the originally hilited button, and twice to hilite
>the newly pressed button), it won't hilite the newly pressed button.

Why do you call it twice?

If you look at Newton Programmer's Guide page 136, or Newton
Programmer's Reference page 98, you'll see that Hilite takes a
parameter and the parameter determines if the view should be hilited
or not.

There is no need to call Hilite twice.

>I keep programming (in my free time) simple games for the Newton, things I
>know that my friends and I would enjoy, and now I'm stuck.

It's ok, you knocked at the right door. There is a mailing list for
developers at yahoo but it's quiet or maybe even dead. There is also
a newsgroup for developers called comp.sys.newton.programmer. Several
developers scan it for helping people and there is little traffic.
Just in case you'd feel bad about posting such questions on
NewtonTalk.

>I don't code for a living,

Nobody codes on the Newton for a living.

>I do it for fun, and I love my Newton so much, that anything I can
>do to make it more fun for me is worth working on. So far I've written a
>lights out style game, a clone of the board game rush hour, a tile moving
>game (where you place the numbers in sequential order),

Why can't we test all these? ;)

Paul

-- 
Philosophie de baignoire - consultations sur rendez-vous.
NPDS: http://newton.kallisys.net:8080/
Apache: http://www.kallisys.com/
-- 
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 : Sat Jul 26 2003 - 13:00:01 PDT