Showing posts with label AX - ActiveX. Show all posts
Showing posts with label AX - ActiveX. Show all posts

Tuesday, January 31, 2012

ActiveX in Axapta


The Microsoft Axapta Object Server supports Microsoft’s COM (Common Object Model), DCOM (Distributed Common Object Model) and ActiveX controls. This enables Microsoft Axapta to use the advanced flexible COM technology either directly or indirectly using third party applications.

In AX, each ActiveX control will be having a classId. This entry will exaplain you how to use html document ActiveX control in Axapta.

How to add ActiveX control to your form 
  • create form by Name MyActiveXExample
  • MyActiveXExample- > design – > New control -> ActiveX
  • Select html document ActiveX control from the list of activex’s displayed by Ax and name the newActiveX control as HtmlActiveX.
  • Make the Autodeclaration property of the newly created ActiveX control to Yes
  • After that , if you want to display html content in that Activex Control,
  • Add the below code in the init() method of your MyActiveXExample form
public void init()
{
str htmlSource;
COMDispFunction webpreviewWrite;
COMVariant text = new COMVariant();
COM ctrl = new COM();
;
super();
htmlSource = @’ <html><pre><hr color="#99CCFF">
<center>
Search in Google
<FORM method=GET action="
http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="
http://www.google.com/">
<IMG SRC="
http://www.google.com/logos/Logo_40wht.gif" <br></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value="en">
<INPUT type=submit name=btnG VALUE="Google Search">
</td></tr></TABLE>
</FORM>
</center></pre>
<hr color="#99CCFF"></html>’;
ctrl.attach(HtmlActiveX.interface());
webpreviewWrite = new COMDispFunction(ctrl, ‘write’, COMDispContext::METHOD);
text.bStr(htmlSource);
HtmlActiveX.open("");
webpreviewWrite.call(text);
HtmlActiveX.close();
}
 The above code will allow use to browse through google without opening the web page , becasue i added the html controls and the functionalites to the controls to search in google.

I have mapped the htmlActiveX control to my Com object and i am writing the html string to the comVariant. Open ActiveX control by .open() method.  Finally i am calling my comdispFunction object i.e webpreviewWrite.call(text) to open the content in the Activex. Then i closed my ActiveX control by using .close() method

Thursday, June 02, 2011

How to use ActiveX in Dynamics Ax

Hi Guys,
Finally I got time to post an article for you.
Today I will show you how to use ActiveX in Dynamics Ax (Axapta)...


When creating an Axapta form, you can benefit from using ActiveX controls. An ActiveX control is a COM object that can be used as a graphical control inside an application.

The software available as ActiveX components spans from simple components such as check and combo boxes, to larger more complex components such as spreadsheets, calendars, Internet browsers, and communication programs.


In this article the screen shots I used of Ax 3.0.
I will tell you step by step as below:
You should have Microsoft Outlook installed on your system.

No warranties, use at your own risk.


1) Open your AOT and point to Forms.


2) Right click on Forms node and select New Form from the context menu as shown below

























3) Rename the form to OutlookAccess












4) Expand the Form nodes and to Designs>Design


5) Right click on Design>New Control>ActiveX as shown below

















ActiveX Browser will open. Select Microsoft Office Outlook View Control as shown below




























6) Create two Groups on form Design. Drag and drop the ActiveX control to the first group and in the second group add a ButtonGroup control as shown below.















7) Now add two buttons to the ButtonGroup. Add Override method "clicked" to each of the button.



8) In the first button's clicked method write "activex.Open();" before super(); as shown below;














9) Write "activex.AddressBook();" in the second button's clicked method before super();












Now your form design looks like this

























10) Save the form and run the form.


Hope it will help you a lot.

Delete caches in Dynamics 365 F&O

In Dynamics 365 Finance and Operations (D365 F&O), clearing the Application Object Tree (AOT) cache usually involves running specific ut...