Occurs when the user presses and then releases the left mouse button over the list
control.
Type | Description |
The Click event is fired when the user releases the left mouse button over the control, if the FireClickOnSelect property is False. If the FireClickOnSelect property is True, the Click event is fired when the user selects a new item in the control ( using the keys or the mouse ). Use a MouseDown or MouseUp event procedure to specify actions that will occur when a mouse button is pressed or released. Unlike the Click MouseDown and MouseUp events lets you distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keyboard modifiers. Use the Change event to notify your application that user clicks an item or presses the ENTER key. Use the SelectionChanged event to notify your application that a new item is selected.
The following VB sample displays the selected value as soon as the user selects a new item ( the FireClickOnSelect property is True ):
Private Sub ComboBox1_Click() Debug.Print ComboBox1.Value End Sub
The following C++ sample displays the selected value as soon as the user selects a new item ( the FireClickOnSelect property is True ):
void OnClickCombobox1() { OutputDebugString( V2S( &m_combobox.GetValue() ) ); }
where the V2S function converts a VARIANT value to a string expression,
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; }
The following VB.NET sample displays the selected value as soon as the user selects a new item ( the FireClickOnSelect property is True ):
Private Sub AxComboBox1_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxComboBox1.ClickEvent Debug.WriteLine(AxComboBox1.Value) End Sub
The following C# sample displays the selected value as soon as the user selects a new item ( the FireClickOnSelect property is True ):
private void axComboBox1_ClickEvent(object sender, EventArgs e) { System.Diagnostics.Debug.WriteLine(axComboBox1.Value.ToString()); }
The following VFP sample displays the selected value as soon as the user selects a new item ( the FireClickOnSelect property is True ):
*** ActiveX Control Event *** wait window nowait thisform.ComboBox1.Object.ValueSyntax for Click event, /NET version, on:
private void Click(object sender) { } Private Sub Click(ByVal sender As System.Object) Handles Click End Sub |
private void ClickEvent(object sender, EventArgs e) { } void OnClick() { } void __fastcall Click(TObject *Sender) { } procedure Click(ASender: TObject; ); begin end; procedure ClickEvent(sender: System.Object; e: System.EventArgs); begin end; begin event Click() end event Click Private Sub ClickEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClickEvent End Sub Private Sub Click() End Sub Private Sub Click() End Sub LPARAMETERS nop PROCEDURE OnClick(oComboBox) RETURN |
<SCRIPT EVENT="Click()" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function Click() End Function </SCRIPT> Procedure OnComClick Forward Send OnComClick End_Procedure METHOD OCX_Click() CLASS MainDialog RETURN NIL void onEvent_Click() { } function Click as v () end function function nativeObject_Click() return |