event SelChange ()
Occurs when the user selects text in the control.

TypeDescription
Use the SelChange event to notify your application that the selected text was changed. The SelChange event is called even if the selection is empty and user moves the cursor. The SelChange event is called anytime when the position of the cursor was changed.  Use the SelText property to get the selected text. The SelStart and SelLenght properties determine the position of the selected text. Use the SelForeColor and SelBackColor properties to specify the colors for the selected text. The CursorPos property specifies the position of the cursor inside the text. The CursorText property gets or sets the text between giving coordinates, formatted or unformatted. The CursorStart property gives the starting position of the text. The CursorEnd property gives the ending position of the text. The PositionToXY property converts the cursor position to (x,y)-coordinates (column,line). The PositionToX property converts the cursor position to x-coordinate (column). The PositionToY property converts the cursor position to y-coordinate (line).

Syntax for SelChange event, /NET version, on:

private void SelChange(object sender)
{
}

Private Sub SelChange(ByVal sender As System.Object) Handles SelChange
End Sub

Syntax for SelChange event, /COM version, on:

private void SelChange(object sender, EventArgs e)
{
}

void OnSelChange()
{
}

void __fastcall SelChange(TObject *Sender)
{
}

procedure SelChange(ASender: TObject; );
begin
end;

procedure SelChange(sender: System.Object; e: System.EventArgs);
begin
end;

begin event SelChange()
end event SelChange

Private Sub SelChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelChange
End Sub

Private Sub SelChange()
End Sub

Private Sub SelChange()
End Sub

LPARAMETERS nop

PROCEDURE OnSelChange(oHTML)
RETURN

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

<SCRIPT EVENT="SelChange()" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function SelChange()
End Function
</SCRIPT>

Procedure OnComSelChange 
	Forward Send OnComSelChange 
End_Procedure

METHOD OCX_SelChange() CLASS MainDialog
RETURN NIL

void onEvent_SelChange()
{
}

function SelChange as v ()
end function

function nativeObject_SelChange()
return

How do I get the selected text?

VBA (MS Access, Excell...)

' SelChange event - Occurs when the user selects text in the control.
Private Sub HTML1_SelChange()
	With HTML1
		Debug.Print( .SelText )
	End With
End Sub

With HTML1
	.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
End With

VB6

' SelChange event - Occurs when the user selects text in the control.
Private Sub HTML1_SelChange()
	With HTML1
		Debug.Print( .SelText )
	End With
End Sub

With HTML1
	.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
End With

VB.NET

' SelChange event - Occurs when the user selects text in the control.
Private Sub Exhtml1_SelChange(ByVal sender As System.Object) Handles Exhtml1.SelChange
	With Exhtml1
		Debug.Print( .SelText )
	End With
End Sub

With Exhtml1
	.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
End With

VB.NET for /COM

' SelChange event - Occurs when the user selects text in the control.
Private Sub AxHTML1_SelChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxHTML1.SelChange
	With AxHTML1
		Debug.Print( .SelText )
	End With
End Sub

With AxHTML1
	.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
End With

C++

// SelChange event - Occurs when the user selects text in the control.
void OnSelChangeHTML1()
{
	/*
		Copy and paste the following directives to your header file as
		it defines the namespace 'EXHTMLLib' for the library: 'ExHTML 1.0 Control Library'
		#import <ExHTML.dll>
		using namespace EXHTMLLib;
	*/
	EXHTMLLib::IHTMLPtr spHTML1 = GetDlgItem(IDC_HTML1)->GetControlUnknown();
	OutputDebugStringW( spHTML1->GetSelText() );
}

EXHTMLLib::IHTMLPtr spHTML1 = GetDlgItem(IDC_HTML1)->GetControlUnknown();
spHTML1->PutText(L"Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.");

C++ Builder

// SelChange event - Occurs when the user selects text in the control.
void __fastcall TForm1::HTML1SelChange(TObject *Sender)
{
	OutputDebugString( HTML1->SelText );
}

HTML1->Text = L"Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.";

C#

// SelChange event - Occurs when the user selects text in the control.
private void exhtml1_SelChange(object sender)
{
	System.Diagnostics.Debug.Print( exhtml1.SelText );
}
//this.exhtml1.SelChange += new exontrol.EXHTMLLib.exg2antt.SelChangeEventHandler(this.exhtml1_SelChange);

exhtml1.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.";

JScript/JavaScript

<BODY onload='Init()'>
<SCRIPT FOR="HTML1" EVENT="SelChange()" LANGUAGE="JScript">
	alert( HTML1.SelText );
</SCRIPT>

<OBJECT CLASSID="clsid:0036F83C-D892-4B7B-AA0B-BEDD8D16A738" id="HTML1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	HTML1.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.";
}
</SCRIPT>
</BODY>

VBScript

<BODY onload='Init()'>
<SCRIPT LANGUAGE="VBScript">
Function HTML1_SelChange()
	With HTML1
		alert( .SelText )
	End With
End Function
</SCRIPT>

<OBJECT CLASSID="clsid:0036F83C-D892-4B7B-AA0B-BEDD8D16A738" id="HTML1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With HTML1
		.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

// SelChange event - Occurs when the user selects text in the control.
private void axHTML1_SelChange(object sender, EventArgs e)
{
	System.Diagnostics.Debug.Print( axHTML1.SelText );
}
//this.axHTML1.SelChange += new EventHandler(this.axHTML1_SelChange);

axHTML1.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.";

X++ (Dynamics Ax 2009)

// SelChange event - Occurs when the user selects text in the control.
void onEvent_SelChange()
{
	;
	print( exhtml1.SelText() );
}

public void init()
{
	;

	super();

	exhtml1.Text("Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.");
}

Delphi 8 (.NET only)

// SelChange event - Occurs when the user selects text in the control.
procedure TWinForm1.AxHTML1_SelChange(sender: System.Object; e: System.EventArgs);
begin
	with AxHTML1 do
	begin
		OutputDebugString( SelText );
	end
end;

with AxHTML1 do
begin
	Text := 'Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.';
end

Delphi (standard)

// SelChange event - Occurs when the user selects text in the control.
procedure TForm1.HTML1SelChange(ASender: TObject; );
begin
	with HTML1 do
	begin
		OutputDebugString( SelText );
	end
end;

with HTML1 do
begin
	Text := 'Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text.';
end

VFP

*** SelChange event - Occurs when the user selects text in the control. ***
LPARAMETERS nop
	with thisform.HTML1
		DEBUGOUT( .SelText )
	endwith

with thisform.HTML1
	.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
endwith

dBASE Plus

/*
with (this.ACTIVEX1.nativeObject)
	SelChange = class::nativeObject_SelChange
endwith
*/
// Occurs when the user selects text in the control.
function nativeObject_SelChange()
	local oHTML
	oHTML = form.Activex1.nativeObject
	? oHTML.SelText 
return

local oHTML

oHTML = form.Activex1.nativeObject
oHTML.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."

XBasic (Alpha Five)

' Occurs when the user selects text in the control.
function SelChange as v ()
	Dim oHTML as P
	oHTML = topparent:CONTROL_ACTIVEX1.activex
	? oHTML.SelText 
end function

Dim oHTML as P

oHTML = topparent:CONTROL_ACTIVEX1.activex
oHTML.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."

Visual Objects

METHOD OCX_Exontrol1SelChange() CLASS MainDialog
	// SelChange event - Occurs when the user selects text in the control.
	OutputDebugString(String2Psz( oDCOCX_Exontrol1:SelText ))
RETURN NIL


oDCOCX_Exontrol1:Text := "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."

PowerBuilder

/*begin event SelChange() - Occurs when the user selects text in the control.*/
/*
	OleObject oHTML
	oHTML = ole_1.Object
	MessageBox("Information",string( oHTML.SelText ))
*/
/*end event SelChange*/

OleObject oHTML

oHTML = ole_1.Object
oHTML.Text = "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."

Visual DataFlex

// Occurs when the user selects text in the control.
Procedure OnComSelChange 
	Forward Send OnComSelChange 
	Showln (ComSelText(Self))
End_Procedure

Procedure OnCreate
	Forward Send OnCreate
	Set ComText to "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."
End_Procedure

XBase++

PROCEDURE OnSelChange(oHTML)
	DevOut( oHTML:SelText() )
RETURN

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oHTML

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oHTML := XbpActiveXControl():new( oForm:drawingArea )
	oHTML:CLSID  := "Exontrol.HTML.1" /*{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}*/
	oHTML:create(,, {10,60},{610,370} )

		oHTML:SelChange := {|| OnSelChange(oHTML)} /*Occurs when the user selects text in the control.*/

		oHTML:Text := "Press the <b>CTRL + S</b> or <b>CTRL + F</b> to search for text."

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN