70 likes | 234 Views
Using ActiveX in AP 145 Applications. David Liebtag. Title slide. ActiveX Controls. An ActiveX control is a reusable software component based on the Component Object Model (COM). An ActiveX control can draw itself, respond to events (such as mouse clicks),
E N D
Using ActiveX in AP 145 Applications David Liebtag Title slide
ActiveX Controls An ActiveX control is a reusable software component based on the Component Object Model (COM). An ActiveX control can draw itself, respond to events (such as mouse clicks), and be managed through properties, methods, and events. ActiveX controls are available both as part of Windows and from third party vendors. Basic text slide
Syntax: Control←CREATECTL Parent 'ACTIVEX' Style Id CtlData Where CtlData is a: • Program identifier, i.e. MSComCtl2.MonthView.2 • Class identifier, i.e. {232E456A-87C3-11D1-8BE3-0000F8754DA1} • URL, i.e. http://www.microsoft.com • Reference to an Active document, i.e. file://\\Documents\MyDoc.doc • HTML fragment, i.e. MSHTML:<body>Hello World</body> The APL2 dialog editor also supports ActiveX controls. Basic text slide
Creating ActiveX Controls: )LOAD 2 GUITOOLS SAVED 2008-04-23 21.46.49 (GMT-4) ⍝ Create a dialog DIALOG←UNICREATEDLG 'SHELL SIZEBORDER MAX MIN’ ⍝ Create an ActiveX control CTLDATA←'MSHTML:<body>Hello World!</body>' CONTROL←CREATECTL DIALOG 'ACTIVEX' '' 32776 CTLDATA Use GUITOOLS utility functions SET_PROPERTY and GET_PROPERTY to access control properties such as position and size. Basic text slide
COM Properties and Methods: Use the COM OBJECT property to get the handle of the ActiveX control's COM object. XOBJECT←'COM OBJECT' GET_PROPERTY CONTROL Use the GUITOOLS utility function CALLCOM to access ActiveX objects’ methods, properties, and event handlers. The syntax of CALLCOM is identical to the syntax for the COM external function. VALUE←CALLCOM 'PROPERTY' XOBJECT 'Property' [Indices] CALLCOM 'PROPERTY' XOBJECT 'Property' [Indices] [Value] RESULT←CALLCOM 'METHOD' XOBJECT 'Method' [Parameters] Basic text slide
COM Events: EVENTS←CALLCOM 'QUERY' 'EVENTS' XOBJECT CALLCOM 'HANDLERS' XOBJECT (1 2⍴'EventName' EventHandler) LOOP: EVENT←WAIT_EVENT 5 →(0=⍴EVENT)/LOOP →(0<DATATYPE (⎕IO+1)⊃EVENT)/COM_EVENT →AP145_EVENT COM_EVENT: (EVOBJECT NAME HANDLER CURSORPOS TIME NAMED POSITIONAL)←7↑EVENT →HANDLER Use the second element of the event array to determine whether the event was issued by AP 145 or an ActiveX object. For ActiveX object events, the second element is a character vector event name. For 145 events, it is an integer scalar message identifier. Basic text slide
Let’s try some things,,, Basic text slide