Page 2 of 2
Re: Menu Creation
Posted: Thu Sep 13, 2018 2:56 pm
by Scott Klement
Like all widgets, the menu widgets were meant to be a part of your screen that you use from your own code. What I mean by that is they weren't meant to be a drop-in replacement for IBM menus. They're just something you can drag onto a screen as part of designing it. So you might use it as a part of your RPG, Cobol, CL, etc application screens to make them look like they have drop down menus, etc, and look more like a Windows program. (If that's applicable to the type of program you're writing.)
You can, of course, use them to modernize the IBM menus if you want... just as you can add any other widget to the menus. Not sure if I'm making my point clearly or not... ?
Anyway... Like any widget that you add to a screen (vs. changing an existing field on the screen) in Genie, you'd need to write JavaScript code when the menu is used to make it work. For your scenario, I'm expecting that you'll use the multiStepAction() feature to run one menu option and then run another. Is that what you're doing?
Or... can you tell us more about what you're doing and what part of it isn't working? It's hard to tell you what you're missing since we don't really know what you're doing.
Re: Menu Creation
Posted: Thu Sep 13, 2018 3:36 pm
by Alex
I am not sure if this applies to what you're trying to do, but you can look into our Atrium module. The sole purpose of this module is to modernize IBM i menus. It automatically integrates with Genie screens through macros.
Re: Menu Creation
Posted: Fri Oct 05, 2018 2:18 pm
by blosear
Sorry in advance if this is a dumb question, but I've done the videos and searched the forums, and I can't find the answer. We have subfile "menus", that have either a number or a code, and a description. We'd like Genie to recognize these, and let us click on the line, then populating either the number or code into the command line, and poke enter. Ex:
Code: Select all
MC400 MERGE UPMC - ITG 10/05/18
Eligibility 14:01:37
NBR KEYWORD OPTION
1 DSPAADR Display Alternate Address
2 DSPADDR Display Alternate Address
3 DSPHPARCD Display HIPAA Relationship Codes
4 MNTAADR Maintain Alternate Address
5 MNTPLNXRF Maintain Plan Cross Reference File
6 MNTTRMR Maintain Term Reason Code
7 MNTMBR Maintain Member
8 MNTEML Maintain Member EMails
9 MNTMBRS Maintain Member - Select
10 MNTCVR Maintain Coverage Group
11 MNTHPASBM Maintain HIPAA Outbound Submitter
12 MNTLPR Maintain Life and AD&D Premiums
More...
Select option by number or keyword: _____
CF1-System Select CF6-Messages CA10-TPA Client CA11-Environment CF24-Signoff
In the above example, we could enter either the number or the command/keyword into the option field to get the result. On one level, it looks to me like a menu, so the number coming from a hyperlink would be fine (just like IBM menu MAIN works in Genie). But the detect menu option doesn't recognize it.
I also got as far as having Genie recognize it as a subfile, but I can see no way to be able to click on a line and have the option input get populated.
Either technique would work, but if we can find one way, we can probably live with that.
I studied Scott's example above with the CMN menu, but that had a fixed number of options, and our data is potentially variable.
Thanks,
Art
Re: Menu Creation
Posted: Fri Oct 05, 2018 4:01 pm
by Scott Klement
Arthur,
Are we talking about using Genie's menu detection (which sounds like what you're describing) or are we talking about using the menu widget (which is what the previous posts in this thread were about)?
Genie does not automatically detect or use the menu widget -- the menu widget is meant to be used as part of your application (RPG program or whatever environment you're using). For example, if you write an RPG program that works with some sort of IFS document, you might want a "File" menu where you can choose Open, Save or Save As, an Edit menu where you have Copy and Paste, etc. You write these menus using the menu widget, and make it a part of your application. They weren't really meant to be navigational menus like the ones that IBM provides in green screen. (For navigational menus, the best option is our Atrium module.)
The CMN example above was meant to show how you could write your own code to adapt the widget so that it could be used on a navigation screen -- but that's your own code, not Genie's automatic detection. If you're willing to write your own code, of course, you can do almost anything you can dream up.
When working with a screen-scraper like Genie its important to always remember that the only information that the tool has is what text to print in which places on the screen. It doesn't know that its a menu -- just that the OS told it to print words in specific places. Genie's menu detection works by looking at "patterns"... i.e. a number, followed by a period, followed by one space, followed by more words, etc. This detection would occur on all screens (regardless of whether they're truly menus) if they happened to exhibit that same pattern.
You can configure a different pattern for menu detection if you like... but the key is... you have to think of something that would uniquely identify your options as being part of a menu.
In your example, I'm having a hard time thinking of a pattern that would be unique to menus. You have a number, followed by some blanks, followed by some words... but that could exist almost anywhere, in subfiles, spooled files, reports, etc. If you can think of something unique, however, you could set it with the menu pattern config option:
http://www.profoundlogic.com/docs/displ ... nu+Pattern
If you are thinking about writing your own code and want to use something like the menu widget (or even write your own menu detection) that is an option, too... maybe for that the CMN example would help you understand how.
Re: Menu Creation
Posted: Tue Oct 09, 2018 12:15 pm
by blosear
Scott,
Thanks for the quick reply. I had ideas where I thought menu identification would work, but I'll drop that for now and go back to subfile identification in Genie. Sorry for thinking Genie would know it is a subfile without further options to clarify.
I was able to get identification to work on a subfile with one less column than the last example I gave you (looks like screenshot PDF in this post). I then found a js example for entering data into a menu option field at the bottom of the screen. The script is:
changeElementValue("I_20_22", "AP"); pressKey("Enter");
So when I click on any subfile grid line, it enters "AP", pokes enter, and all is well.
Now, I'd like to figure out (if possible) how to get the first field out of the grid and into the expression.
I found another post where it appears the user is doing the reverse, taking a literal "5", and putting it into the option field on the subfile line, ex:
changeElementValue("I_" + hiLine + "_2", "5"); pressKey("Enter");
I tried using the hiLine example above to get at the subfile line column, but get an error that hiLine is not defined.
changeElementValue("I_20_22", "I_" + hiLine + "_1"); pressKey("Enter");
The menu definition looks like the screenshot. I want to extract the first column of the grid. If I click on the first line, I want "AP" to go into the entry field. If I click on the third line, I want "AU".
I couldn't find how Genie named the subfile columns (if it does at all). I first tried the I_ prefix, then thought it might want O_. Still got the same error.
Is there a naming convention to the subfile grid columns that I'm not using correctly?
If I'm barking up the wrong tree, please advise. We have source code, and can go with another approach if necessary. But it would be better for demo purposes to show these menus working w/o mods.
Thanks again for you patience,
Art
Re: Menu Creation
Posted: Mon Oct 15, 2018 8:10 am
by blosear
Scott,
Looking over some other examples, I figured out how to extract my value from the subfile grid. The below .js works:
opt = getObj("subfile").grid.getCellValue(row, 0);
/*console.log(opt);*/
changeElementValue("I_20_22", opt);
pressKey("Enter");
I have to reference the same .js code for each line of the grid, but the substitution is dynamic, and enter the value into the input field and pokes enter.
Thanks,
Art