Topic
  • 2 replies
  • Latest Post - ‏2014-06-04T18:12:08Z by danielpaval
danielpaval
danielpaval
2 Posts

Pinned topic HATS top menu links

‏2014-06-03T08:33:59Z |

Hi,

I'm pretty new to HATS and can hardly find any suggestions on having the top menu links point to specific green screen codes (via JS, macro, etc.) instead of the default www.ibm.com URLs rendered in most of the templates (see attached). In other words, when a user picks a top menu entry he should be taken directly to a specific green screen (given the green screen code) skipping any intemediary screens that he'd usually pass through from the system menu to that green screen.

Thanks for any hints,

Daniel.

 

 

Attachments

  • tmparker
    tmparker
    534 Posts

    Re: HATS top menu links

    ‏2014-06-03T18:45:09Z  

    Hi Daniel,

    The templates are generic examples and are a good starting point for developers to customize for their own application.  With that said, what you are trying to do is not very difficult but does require some knowledge of HATS and does require some care when developing the macro to make this happen.  When you record a macro to do this sort of thing you need to make sure it will run correctly from anywhere since you are adding this link to the template and it will show on all screens.  This is not that hard to do, it would just require you to be able to recognize any screen the user is on an back out to the specific place you want to take them.

    As for the code, it's pretty simple, you would just add a link similar to this:

    <a href='javascript:ms("macrorun_NavigateMainMenu","HATSForm");'>Main Menu</a>
    

    When you click the link it will execute the macro with that name.  In this example, my macro was named NavigateMainMenu.

    Thanks
    Tim

     

  • danielpaval
    danielpaval
    2 Posts

    Re: HATS top menu links

    ‏2014-06-04T18:12:08Z  
    • tmparker
    • ‏2014-06-03T18:45:09Z

    Hi Daniel,

    The templates are generic examples and are a good starting point for developers to customize for their own application.  With that said, what you are trying to do is not very difficult but does require some knowledge of HATS and does require some care when developing the macro to make this happen.  When you record a macro to do this sort of thing you need to make sure it will run correctly from anywhere since you are adding this link to the template and it will show on all screens.  This is not that hard to do, it would just require you to be able to recognize any screen the user is on an back out to the specific place you want to take them.

    As for the code, it's pretty simple, you would just add a link similar to this:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr"><a href='javascript:ms("macrorun_NavigateMainMenu","HATSForm");'>Main Menu</a> </pre>

    When you click the link it will execute the macro with that name.  In this example, my macro was named NavigateMainMenu.

    Thanks
    Tim

     

    Hi Tim,

    Thanks for the hint. I managed to create a generic macro that brings the user to the system main menu and then calls the green screen code on the command line via a custom Java macro action (the screen code is sent with each menu link click as a global variable). What was really helpful though was your last post on this topic: the same SendKeys command seems to only work on ECLPS and not on HostScreen (as I initially tried).

    Thanks again,

    Daniel.