tim@nijinsky.ipac.caltech.edu (Tim Conrow) (04/24/91)
Hi all, I was working on my own home grown calender program (as though there weren't enough out there already) and am trying to build some inter- activeness (interactivity?) into it. The folks at HP were very good about making this possible by providing key trapping functions and nice ways to modify graphics objects easily, but I know of only two ways to re-display an altered GROB. One is to use PVIEW, which is unacceptable because the keyboard is taken over, and the other is a sequence like ... PICT RCL \->LCD ... which seems wasteful, and makes the display blink annoyingly when PICT is rewritten (it may be slowing things down too). So what am I missing? How does one update a displayed GROB as fast as possible in response to a key press, preferably "in place", i.e. w/o having to go through an \->LCD phase? (How is it done, for example, in the periodic table display on the EQ LIB card?) E-mail would be fine unless you think the answer is of general interest. C'mon, y'all haven't let me down yet! Thanks very much for your attention. If the results are what I hope for the program may be worth posting. -- Tim Conrow tim@ipac.caltech.edu
ahernsd@mentor.cc.purdue.edu (Dynastar) (04/24/91)
In <1991Apr23.175400.8672@nntp-server.caltech.edu> tim@nijinsky.ipac.caltech.edu (Tim Conrow) writes: >So what am I missing? How does one update a displayed GROB as fast as >possible in response to a key press, preferably "in place", i.e. w/o >having to go through an \->LCD phase? (How is it done, for example, in >the periodic table display on the EQ LIB card?) If you execute { } PVIEW It will display PICT and place you in scrolling mode, in essence, 'taking over the keyboard'. But if you execute { # 0 # 0 } PVIEW It will display PICT and then go on, not entering the interactive graphics environment. If you want to, for example, display GROB 'A', wait 5 seconds, then display GROB 'B' then wait for a keypress, the following program will do it. (I am typing this straight from the terminal, so bear with me!) \<< PICT { # 0 # 0 } A REPL { # 0 # 0 } PVIEW 5 WAIT PICT { # 0 # 0 } B REPL DO UNTIL KEY END DROP \>> Hope this helps!
akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) (04/24/91)
If you want to update a displayed GROB in response to a key press, simply use the PICT display. If you use PVIEW, it does NOT take over the keyboard, it simply displays the PICT. There are two "graphics" screens on the HP-48, the PICT, and the LCD. When you use ->LCD, PROMPT, DISP, and the stack itself, those all use the LCD screen. The PICT is stored in a seperate screen, which can be viewd with PVIEW. If you want to make a calendar program, or whatever, simply create your startup screen first, by either storing a GROB into the PICT, or using REPL, or using LINE, whatever. BTW all of the graphics routines like circle, arc, rectnagle, line, point, etc. draw on the PICT. Notice that you should create your screen before doing PVIEW, you don't want the user looking at how your screen is taking shape. O.K., now that you have created your screen, simply do { #0d #0d } PVIEW to display your PICT. This display will continue, until you switch to the LCD, by finishing the program. O.K>, now you have your screen. Simply make a loop that waits for a key press, or whatever you want. The calculator responds just like normal to a key press and you can modify the PICT whil it is being displayed. So, for example, if you want to hilite each date as the user moves through the month, then wait for the key press indicating that the user pressed the right arrow or whatever, then by incrementing a counter or decremtning or multiplying or whatever you want to do, you find out the next coordinates of the square to be hilited. All you have to do is use SUB to get that GROB, invert it, and REPL it back into the same place. You can do this while in PVIEW, w/o having to meddle with LCD. In general, you can do all the normal graphics things, including REPL, while the calculator is displaying the PICT, an deverything is automatically updated. I hope this solves your problem. I'm not sure what any of your specific problems are, but I hope this helps. BTW, the fastest way to do this is by machine code, but I guessed that you wanted to know how to do this in userlang. Check out the HP manuals, including the WALK program, or better yet , any of the programs out now with graphics (Like my Tetris) for info on userlang graphics. If you really want to get into it, try learnign how to do this stuff with machine code. ---Falco
rrd@hpfcso.FC.HP.COM (Ray Depew) (05/01/91)
To tim@nijinsky.ipac.caltech.edu (Tim Conrow) > I was working on my own home grown calender program (as though there > weren't enough out there already) ... :-) > So what am I missing? How does one update a displayed GROB as fast as > possible in response to a key press, preferably "in place", i.e. w/o > having to go through an \->LCD phase? (How is it done, for example, in > the periodic table display on the EQ LIB card?) The trick is to use { # 0 # 0 } PVIEW near the start of your program, and then use REPL, GOR, GXOR and GAND (if you can write it) to update only certain parts of your grob. If you do have to update huge sections of your grob, then it's best to do it offline and use REPL to import the entire new grob to PICT. There are just too many problems associated with operations that affect PICT directly, like PICT STO. That's where a lot of the flicker comes from. You might consider buying the book "HP48 Graphics", written by a good friend of mine. It contains a lot of work on graphics fundamentals on the 48, and a pretty decent calendar routine :-) , written by Ron Johnson et al and used by permission. Regards Ray Depew HP ICBD -- IC's By Dictatorship rrd@hpfitst1.hp.com