AutoActivate, AutoVerbMenu, DoVerb
AutoActivate determines the circumstances under which an ActiveX control should start to run. AutoVerbMenu enables a context-sensitive menu that, when invoked, displays actions the control knows how to take, such as Open, Edit or Play. DoVerb is a method for activating, editing or playing ActiveX objects.
Usage |
oOLEObject.AutoActivate = nValue nValue = oOLEObjectAutoActivate |
Parameter |
Value |
Meaning |
nValue |
0 |
Manual. The object will not activate on a form, unless programmatically called with the DoVerb method. |
1 |
GotFocus. Activation takes place when the object receives the focus. |
|
2 |
DblClick. Object is activated when double-clicked or when Enter is pressed. This is the default. |
|
3 |
Automatic. The Help file claims this setting will determine when to activate the object based upon the "object's normal method of activation." Double-click seems to be the method of choice for all the ActiveX objects we've tried. |
Example |
ThisForm.OLEBoundControl.AutoActivate = 1 && GotFocus |
Usage |
oOLEObject.DoVerb( [ nVerb ] ) |
Parameter |
Value |
Meaning |
nVerb |
1, 2, 3...n |
The specialized verbs for this object, stored in the Registry. |
0 |
The default action for this object, typically "Play" for multimedia objects and "Edit" for text-based and graphic objects. |
|
-1 |
Activate the object in edit mode, as in-place activation if supported by the object. |
|
-2 |
Activate the object in a separate window. |
|
-3 |
The Help file states that this verb "hides the creator application for an embedded object." We suspect this may be useful in manipulating an application via DDE or Automation while the application is hidden. The application does not run. |
|
-4 |
Activate the object for an in-place editing session only if the object can support in-place editing; otherwise generate error 1426—"OLE error code 0x..." with such informative error messages as "Invalid verb for OLE object," "The server threw an exception" (our favorite) and "Unexpected failure." (So what's an "expected failure"?). You'll want to trap for errors if you use this verb. |
|
-5 |
This setting should allow an object to be edited in its own window, if it supports single-click activation. We haven't found one yet. |
|
-6 |
This parameter should flush all "undo" information. Again, we haven't yet found OLE servers supporting this feature. |
Example |
* OLESamp - activation of an OLE sound sample with varied verbs LOCAL oForm oForm = CREATEOBJECT("Form") oForm.AddObject("oleSound","myOLEControl") oForm.Show() oForm.oleSound.Visible = .T. FOR i = 3 TO -3 STEP - 1 oForm.OleSound.DoVerb(i) WAIT WINDOW "DoVerb of " + LTRIM(STR(i)) + CHR(13) + ; "Press any key to continue..." NEXT RETURN DEFINE CLASS myOLEControl AS OLEControl Height = 20 OLETypeAllowed = 1 DocumentFile = "c:\windows\chimes.wav" * "c:\winnt40\media\chimes.wav" for Win NT ENDDEFINE |
Usage |
oObject.AutoVerbMenu = lShowMenu lShowMenu = oObject.AutoVerbMenu |
Example |
* An extension of the form above, this one has * AutoVerbMenu turned on so that you can call up the * context menu, and a close button to support the needed * READ EVENTS. LOCAL oForm oForm = CREATEOBJECT("Form") oForm.AddObject("oleSound","myOLEControl") oForm.AddObject("cmdClose","cmdClose") WITH oForm.cmdClose .TOP = oForm.Height - (.Height + 10) .Left = 0.5 * (oForm.Width - .Width) .Visible = .T. ENDWITH oForm.Show() oForm.oleSound.Visible = .T. read events RETURN DEFINE CLASS myOLEControl AS OLEControl Height = 20 OLETypeAllowed = 1 DocumentFile = "c:\winnt40\media\chimes.wav" && for Win NT AutoVerbMenu = .T. ENDDEFINE Define class cmdClose as CommandButton AutoSize = .T. Caption = "Close" Procedure Click ThisForm.Release() Clear Events EndProc EndDefine |
See Also |
OLEBoundControl, OLEControl, OLETypeAllowed, Registration Database |