Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > How to change set of Command Interface of Forms by script

Forum

Search UsersRules
How to change set of Command Interface of Forms by script
#1
Interested
Points:: 0
Joined:: Apr 5, 2012

Hi

In form according some algorithm I need to control visibility of form commands as showen in attached pic. for usability of users. How can I do it?

Profile
#2
Guest
Points::
Joined::

Hello, Murat!

You can use roles or functional options to change visibility of items in navigation panel.

Profile
#3
Interested
Points:: 0
Joined:: Apr 5, 2012

I know how to use roles and functional options to change visibility.

The function I need is not related with roles. Functional option may be, but functional options directly related with Constants and constants used for the whole application.

The property I want to do is: In item form there is an attribute. By changing this attribute some command will appear or disappear (This is for easy usability of my users). But this function not deadly needed, if there is way to control comman interface of form by script, it will be better for me and for my users.

Profile
#4
Just came
Points:: 0
Joined:: Jul 3, 2013

Hello, Murat!

You can use functional options linked with information registers
For exaple,
If you need command linked with user that creates a document:

1. Create information register that will keep visibility settings (you can also use a catalog).
Dimension: User, resource: Visible
2. Create a functional option and a functional option parameter.
Link function option with resource of information register and functional option parameter with dimension of information register (see attachment "option.png")
3. Link command with functional option (see attachment "command.png")
4. In form module write the following script:

Code
&AtClient
Procedure UserOnChange(Item)

    SetFormFunctionalOptionParameters(New Structure("User", Object.User));

EndProcedure

&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)

    SetFormFunctionalOptionParameters(New Structure("User", Object.User));

EndProcedure


See example "1cv8.cf" in attachment. Try to change user in document and visibility of commands will change.

Profile
#5
Interested
Points:: 0
Joined:: Apr 5, 2012

Hi, Sergey

I thought, it may be without adding any configuration metadata object (especially, without adding tables in db).

But, that example is useful for me too.

Thanks for an example.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.