NetTalk Central

Author Topic: Cant Hide browse buttos using loc:viewonly  (Read 3522 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Cant Hide browse buttos using loc:viewonly
« on: April 26, 2020, 04:48:02 AM »
Hi, In a Browse, In the Secure Tab I set a condition for View Only, this is a long condition and I dont want to copy it to the Add and delete Form buttons.
Bear in mind that the Secure ViewOnly condition is using "if this happens" and the button condition is "if this does not happen", then is not the same condition, then it is not only to copy tha viewonly condition from secure to buttons but change it.
Ive tried using loc:viewonly=0, p_web.GetValue('_viewonly_')=0, etc and nothing works.
Any way to do it?
Thanks
-----------
Regards
Alberto

Graham

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Cant Hide browse buttos using loc:viewonly
« Reply #1 on: April 26, 2020, 09:10:58 AM »
Hi Alberto

I'm on NT 11.35 - had a quick look at this...

I just set this template option to TRUE and had a look at the generated code - seems you may need to do an override in the embed after this section to get the desired result...

Generated code:
  loc:viewonly = Choose(not(TRUE),0,1)
  if p_web.IfExistsValue('_viewonly_')
    loc:viewonly = p_web.GetValue('_viewonly_')
    p_web.SetSessionValue(clip(loc:divname)&'_viewonly_' & loc:RandomBrowseId,loc:viewonly)
  else
    loc:viewonly = choose(p_web.GetSessionValue(clip(loc:divname)&'_viewonly_' & loc:RandomBrowseId)=1,1,loc:viewonly)
  end
  p_web.SetValue('_viewonly_',loc:viewonly)

One option in embed: "2 End of SetBrowseOptions routine" - this hides Insert/Change/Delete buttons if condition is TRUE

    if MyViewOnlyTest then          ! Your condition
      loc:viewonly = true
      p_web.SetValue('_viewonly_',loc:viewonly)
      p_web.SetSessionValue(clip(loc:divname)&'_viewonly_' & loc:RandomBrowseId,loc:viewonly)
    end

You may have to check other ViewOnly configs that you may have in the browse but hope this helps

Cheers
Graham

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Cant Hide browse buttos using loc:viewonly
« Reply #2 on: April 27, 2020, 03:10:05 AM »
Thanks, Ive done that but , as I said, loc:viewonly=1 does not work in theform buttons condition.
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Cant Hide browse buttos using loc:viewonly
« Reply #3 on: April 28, 2020, 03:08:32 AM »
probably a good idea to post an example of what you have in mind.

cheers
Bruce