Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

wxActiveX Class Reference

#include <wxactivex.h>


Detailed Description

Main class for embedding a ActiveX control.

Use by itself or derive from it

Note:
The utility program (wxie) can generate a list of events, methods & properties for a control. First display the control (File|Display), then get the type info (ActiveX|Get Type Info) - these are copied to the clipboard. Eventually this will be expanded to autogenerate wxWindows source files for a control with all methods etc encapsulated.
Usage:
construct using a ProgId or class id
 new wxActiveX(parent, CLSID_WebBrowser, id, pos, size, style, name)
 new wxActiveX(parent, "ShockwaveFlash.ShockwaveFlash", id, pos, size, style, name)
Properties
Properties can be set using SetProp() and set/retrieved using Prop()
 SetProp(name, wxVariant(x)) 
or
 wxString Prop("<name>") = x
 wxString result = Prop("<name>")
 flash_ctl.Prop("movie") = "file:///movies/test.swf";
 flash_ctl.Prop("Playing") = false;
 wxString current_movie = flash_ctl.Prop("movie");
Methods
Methods are invoked with CallMethod()
 wxVariant result = CallMethod("<name>", args, nargs = -1)
 wxVariant args[] = {0L, "file:///e:/dev/wxie/bug-zap.swf"};
    wxVariant result = X->CallMethod("LoadMovie", args);
events
respond to events with the EVT_ACTIVEX(controlId, eventName, handler) & EVT_ACTIVEX_DISPID(controlId, eventDispId, handler) macros
    BEGIN_EVENT_TABLE(wxIEFrame, wxFrame)
        EVT_ACTIVEX_DISPID(ID_MSHTML, DISPID_STATUSTEXTCHANGE,  OnMSHTMLStatusTextChangeX)
        EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2",   OnMSHTMLBeforeNavigate2X)
        EVT_ACTIVEX(ID_MSHTML, "TitleChange",       OnMSHTMLTitleChangeX)
        EVT_ACTIVEX(ID_MSHTML, "NewWindow2",        OnMSHTMLNewWindow2X)
        EVT_ACTIVEX(ID_MSHTML, "ProgressChange",    OnMSHTMLProgressChangeX)
    END_EVENT_TABLE()

Definition at line 329 of file wxactivex.h.

Public Member Functions

 wxActiveX (wxWindow *parent, REFCLSID clsid, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
 Create using clsid.

 wxActiveX (wxWindow *parent, wxString progId, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
 create using progid.

int GetEventCount () const
 Number of events defined for this control.

const FuncXGetEventDesc (int idx) const
 returns event description by index.

int GetPropCount () const
 Number of properties defined for this control.

const PropXGetPropDesc (int idx) const
 returns property description by index.

const PropXGetPropDesc (wxString name) const
 returns property description by name.

int GetMethodCount () const
 Number of methods defined for this control.

const FuncXGetMethodDesc (int idx) const
 returns method description by name.

const FuncXGetMethodDesc (wxString name) const
 returns method description by name.

void SetProp (MEMBERID name, VARIANTARG &value)
 Set property VARIANTARG value by MEMBERID.

void SetProp (const wxString &name, const wxVariant &value)
 Set property using wxVariant by name.

wxPropertySetter Prop (wxString name)
 Generic Get/Set Property by name. Automatically handles most types.

wxVariant CallMethod (wxString name, wxVariant args[], int nargs=-1)
 Call a method of the ActiveX control. Automatically handles most types.


Related Functions

(Note that these are not member functions.)

bool MSWVariantToVariant (VARIANTARG &va, wxVariant &vx)
 Convert MSW VARIANTARG to wxVariant. Handles basic types, need to add:
  • VT_ARRAY | VT_*
  • better support for VT_UNKNOWN (currently treated as void *)
  • better support for VT_DISPATCH (currently treated as void *).


bool VariantToMSWVariant (const wxVariant &vx, VARIANTARG &va)
 Convert wxVariant to MSW VARIANTARG. Handles basic types, need to add:
  • VT_ARRAY | VT_*
  • better support for VT_UNKNOWN (currently treated as void *)
  • better support for VT_DISPATCH (currently treated as void *).



Member Function Documentation

const FuncX& wxActiveX::GetEventDesc int    idx const
 

returns event description by index.

throws exception for invalid index

const PropX& wxActiveX::GetPropDesc int    idx const
 

returns property description by index.

throws exception for invalid index

const PropX& wxActiveX::GetPropDesc wxString    name const
 

returns property description by name.

throws exception for invalid name

const FuncX& wxActiveX::GetMethodDesc int    idx const
 

returns method description by name.

throws exception for invalid index

const FuncX& wxActiveX::GetMethodDesc wxString    name const
 

returns method description by name.

throws exception for invalid name

wxPropertySetter wxActiveX::Prop wxString    name [inline]
 

Generic Get/Set Property by name. Automatically handles most types.

Parameters:
name Property name to read/set
Returns:
wxPropertySetter, which has overloads for setting/getting the property

Usage:
  • Prop("<name>") = <value>
  • var = Prop("<name>")
  • e.g:
    •  flash_ctl.Prop("movie") = "file:///movies/test.swf";
      
    •  flash_ctl.Prop("Playing") = false;
      
    •  wxString current_movie = flash_ctl.Prop("movie");
      
Exceptions:
raises exception if <name> is invalid
Note:
Have to add a few more type conversions yet ...

Definition at line 458 of file wxactivex.h.

wxVariant wxActiveX::CallMethod wxString    name,
wxVariant    args[],
int    nargs = -1
 

Call a method of the ActiveX control. Automatically handles most types.

Parameters:
name name of method to call
args array of wxVariant's, defaults to NULL (no args)
nargs number of arguments passed via args. Defaults to actual number of args for the method
Returns:
wxVariant

Usage:
  • result = CallMethod("<name>", args, nargs)
  • e.g.
  •             wxVariant args[] = {0L, "file:///e:/dev/wxie/bug-zap.swf"};
                wxVariant result = X->CallMethod("LoadMovie", args);
    
Exceptions:
raises exception if <name> is invalid
Note:
Since wxVariant has built in type conversion, most the std types can be passed easily


Friends And Related Function Documentation

bool MSWVariantToVariant VARIANTARG &    va,
wxVariant &    vx
[related]
 

Convert MSW VARIANTARG to wxVariant. Handles basic types, need to add:

  • VT_ARRAY | VT_*
  • better support for VT_UNKNOWN (currently treated as void *)
  • better support for VT_DISPATCH (currently treated as void *).

Parameters:
va VARAIANTARG to convert from
vx Destination wxVariant
Returns:
success/failure (true/false)

bool VariantToMSWVariant const wxVariant &    vx,
VARIANTARG &    va
[related]
 

Convert wxVariant to MSW VARIANTARG. Handles basic types, need to add:

  • VT_ARRAY | VT_*
  • better support for VT_UNKNOWN (currently treated as void *)
  • better support for VT_DISPATCH (currently treated as void *).

Parameters:
vx wxVariant to convert from
va Destination VARIANTARG
Returns:
success/failure (true/false)


The documentation for this class was generated from the following file:
Generated on Tue Apr 1 14:51:12 2003 for wxActiveX by doxygen1.3-rc3