From: Gurveer on
Hi

Going through the message handlers of the input form from Eduardo's
book, I was trying to make a user defined menu different for each
field which did not seem to work at all. But when I tried one of those
menus in the message handler for the input form as a whole, it did
work. So, is it not possible to have different menus for different
fields? And what would be a good place to look for the examples of
Input form for handling different messages like making fields visible
and invisible? Moreover, can the EDIT key in the standard Inputform
menu be used to run EDITB command. Because I was tring to make an
Inputform in which the allowed field was a matrix. But hitting EDIT
would just take me to the text editor whereas if I go in the Stats
function built in the calculator, in any of the functions, it would
take me to the matrix writer if the allowed object type is a matrix.

Thanks for any help that you provide.

Regards,

Gurveer
From: TW on
> work. So, is it not possible to have different menus for different
> fields?

I don't think so. You could do this by making a menu that behaves
differently depenidng on which field is selected, but it doesn't
appear to be supported.

> And what would be a good place to look for the examples of
> Input form for handling different messages like making fields visible
> and invisible?

I generally stick them in message 5, which is the one run when any
change is made in the field. You can do it anywhere though. You'll use
the IfSetFieldVisible command to hide or unhide things.

> would just take me to the text editor whereas if I go in the Stats
> function built in the calculator, in any of the functions, it would
> take me to the matrix writer if the allowed object type is a matrix.

You'll want to do this using 20 (IfMsgNewCommandLine - only if you
want to active a matrix editor when someone types to prevent direct
editing ) and 25 (ifMsgEdit). I've pasted the actual message handler
from the ROM that is used for this in things like the "single-var"
stat form. It is from the old input form which I don't remember if it
is any different, so it may be slightly different, but the same
general operation will work.

NULLNAME ArrayFP ( ... Msg --> ... T/F )
::
IFM_EDITFIELD
#<>case FALSE
EditArray
TRUE
;

**
** Edit a field with the MatrixWriter.
**
NULLNAME EditArray ( --> )
::
GetMyFieldId RclFieldVal DoArrayEdit
NOT?SEMI
GetMyFieldId SetFieldVal
( allow complete display update )
;

TW
From: Andreas Möller on
Hello,

first, this is possible.
Second, it is tricky.
Third, there is a lot you have to find out by yourself as it is not
officially documented.

There are two InputForm engines, DoInputForm and IfMain and they are
not compatible, they access memory different and they use different
messages.

The description in Eduardo's book covers only the messages for IfMain
and the header file for it is included in debug4x, I do not know if
all messages of DoInputForm have ever been released, some are covered
in 'An Introduction to HP 48 System RPL and Assembly Language
Programming' by James Donnelly. I found a Spanish header file once
somewhere on the net but I do not remember the website. (Maybe HP
could release them officially and send the document to hpcalc.org.)

Fourth, some messages are only for the form, some are only for the
fields and some are for both and this depends on the engine ;-)

> But when I tried one of those
> menus in the message handler for the input form as a whole, it did
> work.
IfMsgGetMenu is only for the form.

> So, is it not possible to have different menus for different
> fields?
Yes, and there are different ways possible. You could use the hardkey
handler (hard key assignments goes over menu assignments), use LAMs
for the menus or IfMsgGetMenu or ...
If you want to go with IfMsgGetMenu (I’d recommend in your case) you
have to include "dynamic" code in the menu.
A menu is

{
"MenuText" <- can be a String, a #MessageBINT or a program which
creates your messages depending on conditions

:: TakeOver
your menu program, create here dynamically what you need and it
will be executed as the menu action. Remember error conditions and low
memory conditions !
;
}

Like I said, it will take some time and work but it can be done, I use
a different/advanced/faster technique for the dynamic menus in my
TreeBrowser.

If you want to know what is going on while the InputForm is running
you can place something like that in your code (in your message
handling code, for example) to see which messages are called and when:

DUP (DUP the message number)
#>$
DoWarning or FlashMessage or whatever you want to make the message
visible

That way you can find out what is going on under the hood (but only at
the surface) ;-)

Also search this newsgroup as there have been some descriptions about
this in the past.

HTH,
Andreas
http://www.software49g.gmxhome.de

From: Dave Hayden on
On Nov 2, 3:26 pm, Gurveer <gurveer....(a)gmail.com> wrote:
> Hi
>
> So, is it not possible to have different menus for different
> fields?
As others have mentioned, IfMsgGetMenu is only called for the form,
but I wonder about IfMsgGet3KeysMenu. Maybe you can use that.
Another possibility is to just change the menu using normal RPL
commands. If you take this path, change the menu in an IfMsgGetFocus
handler and restore it in the IfMsgLooseFocus handler.

Dave

From: John H Meyers on
On Mon, 02 Nov 2009 14:26:19 -0600, Gurveer wrote:

> Is it not possible to have different menus for different fields?

The "Calculator Modes," "Solve Equation,"
TVM (Time Value of Money) forms (and others) do,
so how do they do that?

[r->] [OFF]