event ButtonClick (Ed as Editor, Key as Variant)
Occurs when the user clicks the editor's button.

 TypeDescription 
   Ed as Editor An Editor object where the event occurs.  
   Key as Variant A string expression that indicates the key of the button being pressed.   
The ButtonClick event notifies your application that the user clicks a button. The AddButton method inserts new buttons to the editor. Use the RemoveButton method to remove a button. The ButtonClick event is fired if the user presses the drop down button of an editor. In this case, the Key parameter is empty. Use the Change event to notify your application that the editor's content is altered. If the editor hosts an ActiveX control use the UserEditorOleEvent event to monitor the events that inside ActiveX object fires.

Syntax for ButtonClick event, /NET version, on:

private void ButtonClick(object sender,exontrol.EXRECORDLib.Editor Ed,object Key)
{
}

Private Sub ButtonClick(ByVal sender As System.Object,ByVal Ed As exontrol.EXRECORDLib.Editor,ByVal Key As Object) Handles ButtonClick
End Sub

Syntax for ButtonClick event, /COM version, on:

private void ButtonClick(object sender, AxEXRECORDLib._IRecordEvents_ButtonClickEvent e)
{
}

void OnButtonClick(LPDISPATCH Ed,VARIANT Key)
{
}

void __fastcall ButtonClick(TObject *Sender,Exrecordlib_tlb::IEditor *Ed,Variant Key)
{
}

procedure ButtonClick(ASender: TObject; Ed : IEditor;Key : OleVariant);
begin
end;

procedure ButtonClick(sender: System.Object; e: AxEXRECORDLib._IRecordEvents_ButtonClickEvent);
begin
end;

begin event ButtonClick(oleobject Ed,any Key)
end event ButtonClick

Private Sub ButtonClick(ByVal sender As System.Object, ByVal e As AxEXRECORDLib._IRecordEvents_ButtonClickEvent) Handles ButtonClick
End Sub

Private Sub ButtonClick(ByVal Ed As EXRECORDLibCtl.IEditor,ByVal Key As Variant)
End Sub

Private Sub ButtonClick(ByVal Ed As Object,ByVal Key As Variant)
End Sub

LPARAMETERS Ed,Key

PROCEDURE OnButtonClick(oRecord,Ed,Key)
RETURN

Syntax for ButtonClick event, /COM version (others), on:

<SCRIPT EVENT="ButtonClick(Ed,Key)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function ButtonClick(Ed,Key)
End Function
</SCRIPT>

Procedure OnComButtonClick Variant llEd Variant llKey
	Forward Send OnComButtonClick llEd llKey
End_Procedure

METHOD OCX_ButtonClick(Ed,Key) CLASS MainDialog
RETURN NIL

void onEvent_ButtonClick(COM _Ed,COMVariant _Key)
{
}

function ButtonClick as v (Ed as OLE::Exontrol.Record.1::IEditor,Key as A)
end function

function nativeObject_ButtonClick(Ed,Key)
return

The following VB sample displays the key of the button being clicked:

Private Sub Form_Load()
    With Record1
        With .Add("Calc", CalculatorType)
            .Value = 3.14
            .AddButton "AKey", , 1
            .AddButton "BKey", , 2
        End With
    End With
End Sub

Private Sub Record1_ButtonClick(ByVal Ed As EXRECORDLibCtl.IEditor, ByVal Key As Variant)
    Debug.Print Ed.Label & ", Key = """ & Key & """"
End Sub

The following VC sample displays the key of the button being clicked:

COleVariant vtMissing; vtMissing.vt = VT_ERROR;
CEditor editor = m_record.Add(COleVariant("Calc"), /*CalculatorType*/ 21, vtMissing );
editor.SetValue( COleVariant( 3.14 ) );
editor.AddButton( COleVariant( "AKey" ), vtMissing, COleVariant( (long) 1 ), vtMissing, vtMissing, vtMissing );
editor.AddButton( COleVariant( "BKey" ), vtMissing, COleVariant( (long) 1 ), vtMissing, vtMissing, vtMissing );

static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return szDefault;

		COleVariant vt;
		vt.ChangeType( VT_BSTR, pv );
		return V_BSTR( &vt );
	}
	return szDefault;
}

void OnButtonClickRecord1(LPDISPATCH Ed, const VARIANT FAR& Key) 
{
	CEditor editor( Ed );
	editor.m_bAutoRelease = FALSE;

	TCHAR szOutput[1024];
	wsprintf( szOutput, "%s, Key = \"%s\"\n", (LPCTSTR)editor.GetLabel(), (LPCTSTR)V2S( &(VARIANT&)Key ) );
	OutputDebugString( szOutput );
	
}

Send comments on this topic.
1999-2015 Exontrol.COM, Software. All rights reserved.