I've got some questions that are particularly new-user style questions, so please bear with me as this is the first time I've really dug in deeper to RPL programming. It may help if you've got a little experience with the Casio fx-9860GII (or 9750GII) but it's not needed.

Funnily enough, the bit I thought was going to be the hardest, was actually the easiest; duplicating (roughly) the Casio screen below as a graphical screen on the 50G. I managed to create a routine for creating the PICT I need, though I should probably leave the bottom 8 pixels free to set up a menu.

This screen (taken from the Casio) describes the pieces I want to present:

Q1. Multiple var initialisation
I want to do a wholesale initialisation of variables, but so far all I've been able to come up with is the usual (for me):

\<< 0 'VEGE' STO 0 'MEAT' STO 0 'MISC' STO ... \>>

Now I'm jolly sure there's a far more efficient way of doing multiple variable assignment. Have I missed something in the UM/UG? I even had a look in the AUR, and didn't see what I wanted there either. Basically I want to either set all the categories to zero on initial start (and set the tax to a set rate), or set all the categories from previously stored data (ditto tax).

Q2. Running with a graphical screen and menu (i.e. no stack display)
This is trickier for me, as I had to use a loop and GetKey() on Casio, making the calculator cycle constantly through the loop and hence use more battery. The reason is because Casio's GetKey() returns immediately, regardless of whether a key was pressed or not. I'm looking for a better option on HP-50g, where I can display the graphical screen above, plus a menu, and then the calculator waits (without spinning its wheels like crazy) until I press a menu key. Each menu key fires up a sub-program to request a value from the user, set the relevant variable, then pass back to the main program, which updates the displayed variables, shows a grand total, and waits until I press a menu key (or Exit).

Q2a. Can I display INPUT on top of a graphics screen?
This would be the least visually disturbing, as otherwise I'd be jumping between a cleared out text screen requester, then back to the graphics screen, then a cleared out text screen requester, etc. Yuck. Still, if I have to do it that way, I have to do it that way.

Q3. Speed of GUI vs text
Can I run a graphical interface at nearly the same speed as a stack-based text interface? So far, to write onto the graphics screen, I do PICT RCL, create a tiny GROB with changed data, and use GOR at a specific location, save the PICT back and display it again ({} PVIEW). I can't think of a faster way to do this, and I'm sure it'll be slow. One other thing I haven't yet worked out (though this should be easy) is how to blank-out then write figures anew on the PICT.

Conclusion, at least for now
I think I can probably do most of the other functionality I think I need, it's just tying it all together that may be the issue, at least for RPL. I was thinking the main control could be a DO ...(run main loop) UNTIL (some-end-condition) END but I'll get that done once I've got most of the subprograms written.

If y'all need further explanations (i.e. more detailed workflow for the program), shout out here and I'll see what I can do. I wrote the initial Casio program after all .

(09-01-2017 10:34 AM)brickviking Wrote: Q1. Multiple var initialisation
I want to do a wholesale initialisation of variables, but so far all I've been able to come up with is the usual (for me):

\<< 0 'VEGE' STO 0 'MEAT' STO 0 'MISC' STO ... \>>

Hi,

0 {'VEGE' 'MEAT' MISC' } STO

See parallel processing in the AUR

Quote:Q2. Running with a graphical screen and menu (i.e. no stack display)
This is trickier for me, as I had to use a loop and GetKey() on Casio, making the calculator cycle constantly through the loop and hence use more battery. The reason is because Casio's GetKey() returns immediately, regardless of whether a key was pressed or not. I'm looking for a better option on HP-50g,

0. WAIT

Quote:[size=medium]Q3. Speed of GUI vs text
Can I run a graphical interface at nearly the same speed as a stack-based text interface? So far, to write onto the graphics screen, I do PICT RCL, create a tiny GROB with changed data, and use GOR at a specific location, save the PICT back and display it again ({} PVIEW). I can't think of a faster way to do this, and I'm sure it'll be slow. One other thing I haven't yet worked out (though this should be easy) is how to blank-out then write figures anew on the PICT.

Why did you " save the PICT back and display it again ({} PVIEW). " ?
There is no need for PICT RCL etc.
You can write directly on the screen like this :

«
{#0 #0 } PVIEW
PICT {#10 #10} "HELLO!!" 1. ->GROB REPL
3 FREEZE
»

Imho I dont think that using graphic is the best way to do what you want. Take a look at INFORM, CHOOSE, INPUT etc. (see AUR 1-37 ...)

To write program in user RPL for the 50g, I use HPUserEdit with Emu48. It's very efficient.

(09-01-2017 10:34 AM)brickviking Wrote: Q1. Multiple var initialisation
I want to do a wholesale initialisation of variables, but so far all I've been able to come up with is the usual (for me):

\<< 0 'VEGE' STO 0 'MEAT' STO 0 'MISC' STO ... \>>

0 {'VEGE' 'MEAT' MISC' } STO

See parallel processing in the AUR

[/quote]

Now that's neat. I hadn't realised that was even there, I'm still working through bits of the AUR, and it's where I found out about WAIT and FREEZE.

(09-01-2017 10:34 AM)brickviking Wrote: to write onto the graphics screen, I do PICT RCL, create a tiny GROB with changed data, and use GOR at a specific location, save the PICT back and display it again ({} PVIEW).

(09-03-2017 08:01 PM)Gilles59 Wrote: Why did you " save the PICT back and display it again ({} PVIEW). " ?

Partly due to inexperience, I'm still new to programming in RPL. In my experience, once something's stored to a variable (for safety), it's normally removed from the stack, hence the RCL. I also thought that PVIEW showed the stored contents of the PICT variable, not the "in-progress" version that hasn't been saved yet.

(09-03-2017 08:01 PM)Gilles59 Wrote: There is no need for PICT RCL etc.
You can write directly on the screen like this :

«
{#0 #0 } PVIEW
PICT {#10 #10} "HELLO!!" 1. →GROB REPL
3 FREEZE
»

I didn't know about REPL when I was looking at GROB stuff, it's probably another section of the AUR to look at.

(09-03-2017 08:01 PM)Gilles59 Wrote: Imho I dont think that using graphic is the best way to do what you want. Take a look at INFORM, CHOOSE, INPUT etc.

I looked at those, and I would be using those for inputting of prices. I wanted to have those displayed over the top of the running grocery screen, but I haven't been able to do that on the HP or the Casio.

The whole idea of this grocery program (at least for me) is to show a running total of categories as I go. In effect, I request a category (Veges, Meat, Misc, etc), ask the user what they paid for that item, then add it to the running total.

Rough flow goes like this (user presses <btn>, program functions are [cmd]):

You can do this, and in some ways this may actually be simpler than what you're thinking. The 50g already knows how to wait for the user to press a menu key, and it does that essentially with the processor turned off (even when the power is on and the display is active). So power drain is minimized if you simply leave it in an idle state waiting for the next user action to take place. If you alter your approach to a slightly different model, you may find that it's easier to achieve what you're wanting to do.

Specifically, instead of thinking of this as one big application with a "loop until done" structure, think of it as a collection of apps (one for each menu key) that all perform their function and then end by updating the display (and a final FREEZE to keep that part of the screen fixed). You'd probably want to put the code for that in a separate program that each menu program calls at the end.

(09-01-2017 10:34 AM)brickviking Wrote: Q2a. Can I display INPUT on top of a graphics screen?

No, INPUT doesn't allow that. It takes over the entire display, as does INFORM. CHOOSE and MSGBOX put their contents in a "box" on top of whatever was already in the display, but off the top of my head I can't think of any other UserRPL commands that work that way.

(09-01-2017 10:34 AM)brickviking Wrote: Q3. Speed of GUI vs text
Can I run a graphical interface at nearly the same speed as a stack-based text interface? So far, to write onto the graphics screen, I do PICT RCL, create a tiny GROB with changed data, and use GOR at a specific location, save the PICT back and display it again ({} PVIEW). I can't think of a faster way to do this, and I'm sure it'll be slow. One other thing I haven't yet worked out (though this should be easy) is how to blank-out then write figures anew on the PICT.

It may depend on how complex and lengthy your drawing routines end up being. As Gilles has mentioned, REPL is probably a better approach than GOR. Also, I think {} PVIEW is a special case that actually stops your program's execution -- it's probably better to use {#0 #0} PVIEW and FREEZE as needed so that you can still execute code after the display has been updated.

I hope you persevere and follow through with this. You'll end up learning a lot about the system (and RPL in general) by the time you finish it, regardless of what approach you use. Please continue to share your progress!

That collection of applications is almost exactly what I'd thought of, I realised I could probably call up "Vege" "Meat" etc as separate little input programs early on. What I didn't know how to do is to input values without "leaving" that graphic screen, however I think that's a bit beyond what I'm capable of at the moment. Your idea of using REPL instead is definitely much better than GOR, I just happened to use GOR because it's the first function I actually found.

Your programs will definitely give me a leg up, but what I'm missing now is a way to provide an input to the vars VEGE, MEAT, etc.

That's now looking pretty simple with a dramatic reduction of whitespace, so thanks for that. And in addition, my GRCBTN program will get some rework to convert all the GOR over to REPL, that may speed things up a little.

(09-07-2017 08:57 PM)brickviking Wrote: ...What I didn't know how to do is to input values without "leaving" that graphic screen, however I think that's a bit beyond what I'm capable of at the moment.

I don't know of a way to do that with INPUT, PROMPT, or INFORM. Perhaps someone else knows of a way, but as far as I can see all of those will "take over" the display when activated. It's possible that a way could be crafted with SysRPL/Saturn code, but if you were to go that route, you'd probably be better off re-working the whole thing into a POL-based app (Parameterized Outer Loop) or more likely a form-based approach (a more versatile version of the INFORM command).

(09-07-2017 08:57 PM)brickviking Wrote: ...what I'm missing now is a way to provide an input to the vars VEGE, MEAT, etc.

Honestly, I think your best bet for now is to simply use something like INPUT for that. The display will be reset to show the prompt that you supply, but you can then re-display PICT after the input has been processed. It may not be as clean as you had originally hoped, but it should work.

(09-07-2017 08:57 PM)brickviking Wrote: ...what I'm missing now is a way to provide an input to the vars VEGE, MEAT, etc.

Honestly, I think your best bet for now is to simply use something like INPUT for that. The display will be reset to show the prompt that you supply, but you can then re-display PICT after the input has been processed. It may not be as clean as you had originally hoped, but it should work.

Yeah, I had to do that with the original Casio environment as well. I used the framework and words as the background (i.e. stuff that won't change), and just wrote extra bits into the screen when I updated the totals. I found I had to do that simply for speed's sake, and it looks like I'll need to repeat the same here.