How to call common module code &AtClient?

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Feb 28, 2012
Company:

Hello,

We are having trouble puting our &AtClient code inside our managed forms to a common module. It seems that in a managed form if you have a procedure &Atclient the only procedures that are visible are local procedures of that form (&AtClient or &AtServer).If i create a global common module (and tick the client on the properties)  the procedures i define there are not accesible by a managed form. Is this by design or we are missing something? .Because of this we have a lot of code duplication in our forms.

 
#2
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Constantinos Anastasiou.

The common module can be accessible for client or not depending on the settings of the module. If you want to call a procedure of a server common module from the client (&AtClient), that server method should have Server call option enabled. Otherwise you need to call that procedure from the server (&AtServer) procedure.

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 22, 2015
Company:

Maybe You forgot add key word Export? Like:

Code
Procedure CalculateTotal (TabularSectionRow) Export

The Export keyword in the procedure title indicates that the procedure can be accessed from other applied solution modules

 
#4
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Feb 28, 2012
Company:

As i mentioned on my initial post with &AtServer modules its fine. the problem is with code &AtClient whicj i need to put in a common module.

For example lets say i have this code in a command inside a managed form:

Code
&AtClient 
Procedure ScanOnChange(Item) 
  qForm = GetForm("CommonForm.InputQuantityForm");
  searchQuantity = qForm.DoModal();
EndPRocedure.

How can i put the code in red in a common module and call it from my managed form?

Edited: Constantinos Anastasiou - Jul 30, 2015 01:31 AM
 
#5
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 22, 2015
Company:

So You want connect form's element event with common module code directrly? You can't do this. You need both code in form and in common module:

Code
&AtClient
Procedure ScanOnChange(Item) 
    searchQuantity = YourCommonModule.SearchQuantity();
EndProcedure

And put you red code in function SearchQuantity in common module

Edited: Valeriy Dyachenko - Jul 30, 2015 01:32 AM
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.