NetTalk Central

Author Topic: conditionally hide a button on Menu Extension(3)  (Read 3697 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 398
    • View Profile
    • Email
conditionally hide a button on Menu Extension(3)
« on: April 26, 2020, 08:17:34 PM »
Hi,
I have  buttons on the menu which I can hide, depending on login Access level.
I have one button that is not  dependent on access level but I want to be able to conditionally  hide it, some other way by code,  as there does not seem to be any other option in the template.
I need it hidden prior to login.

Thanks
Richard
NT 11.33
« Last Edit: April 26, 2020, 08:47:11 PM by Richard I »

Graham

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: conditionally hide a button on Menu Extension(3)
« Reply #1 on: April 27, 2020, 01:18:36 AM »
Hi Richard

Off the top of my head, Security Tab, check "User must be logged in" - that will hide the button until User Logged in

After Login, can use a Session Variable eg. 'ShowMyMenuButton' then on Menu, General Tab, "Menu Condition" you could then do:  p_web.GSV('ShowMyMenuButton')

To provide a bit more certainty, an option would be to create a standard Clarion Source procedure with p_web as parameter

    Procedure MenuButtonTest (NetWebServerWorker p_web), byte
    code
      if p_web.IfExistsSessionValue('ShowMyMenuButton')
        return p_web.GSV('ShowMyMenuButton')
      else
        return false
      end

then on Menu, General Tab, "Menu Condition":  MenuButtonTest(p_web)

In your code, do p_web.SSV('ShowMyMenuButton', 0) to hide button and p_web.SSV('ShowMyMenuButton', 1) to show button.

May be a few other ways to do this but hope that gives you some ideas

Cheers
Graham


Richard I

  • Sr. Member
  • ****
  • Posts: 398
    • View Profile
    • Email
Re: conditionally hide a button on Menu Extension(3)
« Reply #2 on: April 27, 2020, 04:32:01 PM »
Thanks Graham,
Looks good and its definitely the path I want to go down.
The idea is to supply the net app version to different clients and those not using the button option, dont see it.
Cheers
Richard