NetTalk Central

Author Topic: How to select a tab when in change stage  (Read 1888 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
How to select a tab when in change stage
« on: December 16, 2020, 07:39:25 AM »
Hi Bruce...

Trying and studying the code... Ive soved this using:

  IF p_web.FormSettings.action = Net:ChangeRecord or p_web.FormSettings.action = 0
      p_web.ChangeTab(loc:TabStyle,'UpdateEmpresas',1)
  END

But I have a problem (look at the "or p_web.FormSettings.action = 0")

If I use the form from a Browse it works ok, only in change mode I go to the 2nd tab, but if I call the form from a menu item using Change and the ID using p_web.AddBrowseValue('pageheadertag','empresas',emp:guidkey,p_web.gsv('emp:guid'))

p_web.FormSettings.action is never Net:ChangeRecord and loc:act is never 2

Thats why I add "or p_web.FormSettings.action = 0", only way I found.

Am I doing something wrong? or its a bug?

NT11.47

Regards
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: How to select a tab when in change stage
« Reply #1 on: December 16, 2020, 10:17:30 PM »
Post an example Alberto. Either your menu call is wrong, or your code is embedded in the wrong place.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to select a tab when in change stage
« Reply #2 on: December 18, 2020, 04:52:31 AM »
Cant do an example now, but FWIW

This is my code (see img 2):
Code: [Select]
  ! Start of "After setting SelectField"
  ! [Priority 5000]
    p_web.AddLog(p_web.FormSettings.action&' = '&Net:ChangeRecord)
    IF p_web.FormSettings.action = Net:ChangeRecord or p_web.FormSettings.action = 0
      !p_web.SetSessionValue('UpdatePeriodos:Active',2)
        p_web.ChangeTab(loc:TabStyle,'UpdateEmpresas',1)
    END
 
  ! End of "After setting SelectField"

And my item menu (img1)

I dont think my item menu is wrong because the form opens ok in the correct record but may be Im wrong.

Regards

-----------
Regards
Alberto

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: How to select a tab when in change stage
« Reply #3 on: December 19, 2020, 03:44:06 AM »
I have used the button’s URL value as a condition in forms.  Might be an option for you.

If p_web.GetValue(‘insert_btn’) = ‘insert’
    !Do stuff
Elsif p_web.GetValue(‘change_btn’) = ‘change’
    !Do Stuff
End

Or pass a custom value from the menu:

If p_web.GetValue(‘FromMenu’) = 1
    !Do stuff
End
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11