(RPG)Reload MainMenu programatically

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

(RPG)Reload MainMenu programatically

Post by MegumiSawada »

Hi

I think it is possible to terminate the programs with following code:

if (RequestACTION = 'XXXXXX');
RequestPROGRAM = 'SYS-EXIT';
RequestACTION = 'SYS-EXIT';
Iter;
endif;

But you need to touch reload button to show the MainMenu.
Is it possible to reload MainMenu programatically?

Thank you in advance.
Best Regards,
Megumi
tsupartono
Posts: 289
Joined: Wed Apr 18, 2012 10:21 am

Re: (RPG)Reload MainMenu programatically

Post by tsupartono »

So you'd basically want the main menu to appear when you don't have any form to show?
We can adjust LongRange to do that.
MarkDuignan
Posts: 346
Joined: Wed Apr 18, 2012 10:33 am

Re: (RPG)Reload MainMenu programatically

Post by MarkDuignan »

Are you trying to just close the 5250 session or using secondary (multi-user per device) logon/off scenario?

If you are designing a secondary logon/logoff scenario then please look at these building blocks in the LRNG_PROJ/QRPGLESRC source file (latest RV11 server version)…
LOGOFFUSER – Logs a user off
LOGONUSER - Performs a secondary logon

This pair of programs are designed to work together - but any program can logically log off this way.

The relevant lines are in LOGOFF

If ( DynamicMenusAreBeingUsed <> 0 );

// Now transfer the request to log on again

RequestPROGRAM = SecondaryLogonPROGRAM;
RequestACTION = 'DEFAULT';

// Otherwise get the Longrange driver program to terminate any active 5250 session

Else;

RequestPROGRAM = 'SYS-EXIT';
RequestACTION = 'SYS-EXIT';

Endif;

And when the secondary logon program is used it does this every time it starts:

LRNG_SetBoolProperty('System.Status.SchemaInitCompleted':False);

And when the user successfully signs on this is done to cause the menu to appear allowing the logged on user to select what they want to do,

LRNG_SetBoolProperty('System.Status.SchemaInitCompleted':True);
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

Re: (RPG)Reload MainMenu programatically

Post by MegumiSawada »

Hi Tony,
Thank you. However,you don't need to do so.

Hi Mark,
Our customer doesn't use logon/off scenario,but expect to share one device with many people.
They'd just like to show menu after terminating currently working formview.

I have looked at LOGONUSER and LOGOFFUSER, but I'm not sure what to do.
You told that
LRNG_SetBoolProperty('System.Status.SchemaInitCompleted':True);
will cause to menu to appear,however, I cannot make my program to do that.
Does it work over there?

Regards,
Megumi
MarkDuignan
Posts: 346
Joined: Wed Apr 18, 2012 10:33 am

Re: (RPG)Reload MainMenu programatically

Post by MarkDuignan »

LRNG_SetBoolProperty('System.Status.SchemaInitCompleted':True); should work if you present an empty screen – but definitely not if what you do next is a SYS-EXIT operation - immediately after setting the property. When you do that the 5250 session is ended – so your SchemaInitCompleted property setting change never gets sent out to the client device.

Can you describe exactly what the customer wants to do?
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

Re: (RPG)Reload MainMenu programatically

Post by MegumiSawada »

Hi Mark,

What the customer would like to do is as follows:

There're two formviews under the MainMenu.
A couple of users will use the same device.
They would like to show MainMenu when user finish operation either of formviews for next operation(or for next user).
They wouldn't use User/Password scenario for the formviews, but they will request and check the password when user do some operation on the formview.

I suggest them they can use a formview(e.g."TOP MENU")which shows two buttons to switch to each formviews to achieve their requirements (and I think that is more user-friendly) .
However I wanted to know if it is possible to show menu programatically.

Thank you for your support.
Best Regards,
Megumi
MarkDuignan
Posts: 346
Joined: Wed Apr 18, 2012 10:33 am

Re: (RPG)Reload MainMenu programatically

Post by MarkDuignan »

I don’t think you could. You would need the user to interact with a FormView to cause the menu reset (and display) request to be send out to display the menu - which is why it works with a sign on operation.

I think your solution to use form view as their menu or homepage is the best solution. This can be plugged in as the startup formview and they can switch back to it programmatically whenever they want to. With RV11 they can also make it the target of their ‘back buttons’ on the title bar. In effect they would not bother to use the LongRange menu structure because the application is so simple.

Note: You can define form views in LR Studio that are not attached to any left hand LR main menus.

Go to the “Form Views” entry in the main LR Studio tree. Right click and choose “New Form View”. Define your form view and make sure it is given a symbolic name at the bottom. You can attach commands to it in the usual way. Working this way you can have your own menu / homepage and many form views navigating amongst themselves – all without using the LR left hand menu structure at all. The LR left hand main menus are optional.

The concept of a ‘home page’ or ‘main menu’ is common in mobile applications. Typically these look like miniature desktop with large easy to select icons – sometimes overlaid with some sort of short summary (eg: messages waiting count) or something to attract a user’s attention to something they need to look at.

Here is an example of a Dutch demonstration ‘home page’ done using LongRange (it was set up to mimic the home page of real application as part of a proof of concept exercise) …
shot1.png
shot1.png (47.88 KiB) Viewed 8468 times
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

Re: (RPG)Reload MainMenu programatically

Post by MegumiSawada »

I see.
I'll recommend them to use 'homepage' instead.
Thank you for your advice!
Post Reply