event Change (Layer as Long)
Occurs when the layer's value is changed.

 TypeDescription 
   Layer as Long A long expression that specifies the index of the layer whose value is being changed. The Item property of Layers collection gets the layer based on its index.  
The Change event occurs when any of the following properties:

are changed. For instance, you can use the Change event to update other layers when one of the layer is changed. The OnDrag property indicates the action to be performed when the user drags the layer. The DragStart / Drag / DragEnd events notify your application when a layer is dragged. The MouseWheel occurs when the mouse wheel is rolled.

Syntax for Change event, /NET version, on:

private void Change(object sender,int   Layer)
{
}

Private Sub Change(ByVal sender As System.Object,ByVal Layer As Integer) Handles Change
End Sub

Syntax for Change event, /COM version, on:

private void Change(object sender, AxEXGAUGELib._IGaugeEvents_ChangeEvent e)
{
}

void OnChange(long   Layer)
{
}

void __fastcall Change(TObject *Sender,long   Layer)
{
}

procedure Change(ASender: TObject; Layer : Integer);
begin
end;

procedure Change(sender: System.Object; e: AxEXGAUGELib._IGaugeEvents_ChangeEvent);
begin
end;

begin event Change(long  Layer)

end event Change

Private Sub Change(ByVal sender As System.Object, ByVal e As AxEXGAUGELib._IGaugeEvents_ChangeEvent) Handles Change
End Sub

Private Sub Change(ByVal Layer As Long)
End Sub

Private Sub Change(ByVal Layer As Long)
End Sub

LPARAMETERS Layer

PROCEDURE OnChange(oGauge,Layer)

RETURN

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

<SCRIPT EVENT="Change(Layer)" LANGUAGE="JScript">
</SCRIPT>

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

Procedure OnComChange Integer   llLayer
	Forward Send OnComChange llLayer
End_Procedure

METHOD OCX_Change(Layer) CLASS MainDialog
RETURN NIL

void onEvent_Change(int   _Layer)
{
}

function Change as v (Layer  as  N)
end function

function nativeObject_Change(Layer)
return

The following samples show how you can display the current offset, when user drags the layer:

VBA (MS Access, Excell...)

' Change event - Occurs when the layer's value is changed.
Private Sub Gauge1_Change(ByVal Layer As Long)
	With Gauge1
		.Caption(0) = .Layers.Item(Layer).OffsetX
	End With
End Sub

With Gauge1
	.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
	.PicturesName = "`Layer` + int(value  + 1) + `.png`"
	.Layers.Count = 1
	With .Layers.Item(0)
		.OnDrag = 1
		.OffsetYValid = "0"
	End With
End With

VB6

' Change event - Occurs when the layer's value is changed.
Private Sub Gauge1_Change(ByVal Layer As Long)
	With Gauge1
		.Caption(exLayerCaption) = .Layers.Item(Layer).OffsetX
	End With
End Sub

With Gauge1
	.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
	.PicturesName = "`Layer` + int(value  + 1) + `.png`"
	.Layers.Count = 1
	With .Layers.Item(0)
		.OnDrag = exDoMove
		.OffsetYValid = "0"
	End With
End With

VB.NET

' Change event - Occurs when the layer's value is changed.
Private Sub Exgauge1_Change(ByVal sender As System.Object,ByVal Layer As Integer) Handles Exgauge1.Change
	With Exgauge1
		.set_Caption(exontrol.EXGAUGELib.PropertyLayerCaptionEnum.exLayerCaption,.Layers.Item(Layer).OffsetX)
	End With
End Sub

With Exgauge1
	.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
	.PicturesName = "`Layer` + int(value  + 1) + `.png`"
	.Layers.Count = 1
	With .Layers.Item(0)
		.OnDrag = exontrol.EXGAUGELib.OnDragLayerEnum.exDoMove
		.OffsetYValid = "0"
	End With
End With

VB.NET for /COM

' Change event - Occurs when the layer's value is changed.
Private Sub AxGauge1_Change(ByVal sender As System.Object, ByVal e As AxEXGAUGELib._IGaugeEvents_ChangeEvent) Handles AxGauge1.Change
	With AxGauge1
		.set_Caption(EXGAUGELib.PropertyLayerCaptionEnum.exLayerCaption,.Layers.Item(e.layer).OffsetX)
	End With
End Sub

With AxGauge1
	.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
	.PicturesName = "`Layer` + int(value  + 1) + `.png`"
	.Layers.Count = 1
	With .Layers.Item(0)
		.OnDrag = EXGAUGELib.OnDragLayerEnum.exDoMove
		.OffsetYValid = "0"
	End With
End With

C++

// Change event - Occurs when the layer's value is changed.
void OnChangeGauge1(long   Layer)
{
	/*
		Copy and paste the following directives to your header file as
		it defines the namespace 'EXGAUGELib' for the library: 'ExGauge 1.0 Control Library'
		#import <ExGauge.dll>
		using namespace EXGAUGELib;
	*/
	EXGAUGELib::IGaugePtr spGauge1 = GetDlgItem(IDC_GAUGE1)->GetControlUnknown();
	spGauge1->PutCaption(EXGAUGELib::exLayerCaption,spGauge1->GetLayers()->GetItem(Layer)->GetOffsetX());
}

EXGAUGELib::IGaugePtr spGauge1 = GetDlgItem(IDC_GAUGE1)->GetControlUnknown();
spGauge1->PutPicturesPath(L"C:\\Program Files (x86)\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob");
spGauge1->PutPicturesName(L"`Layer` + int(value  + 1) + `.png`");
spGauge1->GetLayers()->PutCount(1);
EXGAUGELib::ILayerPtr var_Layer = spGauge1->GetLayers()->GetItem(long(0));
	var_Layer->PutOnDrag(EXGAUGELib::exDoMove);
	var_Layer->PutOffsetYValid(L"0");

C++ Builder

// Change event - Occurs when the layer's value is changed.
void __fastcall TForm1::Gauge1Change(TObject *Sender,long   Layer)
{
	Gauge1->Caption[Exgaugelib_tlb::PropertyLayerCaptionEnum::exLayerCaption] = TVariant(Gauge1->Layers->get_Item(TVariant(Layer))->OffsetX);
}

Gauge1->PicturesPath = L"C:\\Program Files (x86)\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob";
Gauge1->PicturesName = L"`Layer` + int(value  + 1) + `.png`";
Gauge1->Layers->Count = 1;
Exgaugelib_tlb::ILayerPtr var_Layer = Gauge1->Layers->get_Item(TVariant(0));
	var_Layer->OnDrag = Exgaugelib_tlb::OnDragLayerEnum::exDoMove;
	var_Layer->OffsetYValid = L"0";

C#

// Change event - Occurs when the layer's value is changed.
private void exgauge1_Change(object sender,int   Layer)
{
	exgauge1.set_Caption(exontrol.EXGAUGELib.PropertyLayerCaptionEnum.exLayerCaption,exgauge1.Layers[Layer].OffsetX);
}
//this.exgauge1.Change += new exontrol.EXGAUGELib.exg2antt.ChangeEventHandler(this.exgauge1_Change);

exgauge1.PicturesPath = "C:\\Program Files (x86)\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob";
exgauge1.PicturesName = "`Layer` + int(value  + 1) + `.png`";
exgauge1.Layers.Count = 1;
exontrol.EXGAUGELib.Layer var_Layer = exgauge1.Layers[0];
	var_Layer.OnDrag = exontrol.EXGAUGELib.OnDragLayerEnum.exDoMove;
	var_Layer.OffsetYValid = "0";

JScript/JavaScript

<BODY onload="Init()">
<SCRIPT FOR="Gauge1" EVENT="Change(Layer)" LANGUAGE="JScript">
	Gauge1.Caption(0) = Gauge1.Layers.Item(Layer).OffsetX;
</SCRIPT>

<OBJECT CLASSID="clsid:91628F12-393C-44EF-A558-83ED1790AAD3" id="Gauge1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	Gauge1.PicturesPath = "C:\\Program Files (x86)\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob";
	Gauge1.PicturesName = "`Layer` + int(value  + 1) + `.png`";
	Gauge1.Layers.Count = 1;
	var var_Layer = Gauge1.Layers.Item(0);
		var_Layer.OnDrag = 1;
		var_Layer.OffsetYValid = "0";
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<SCRIPT LANGUAGE="VBScript">
Function Gauge1_Change(Layer)
	With Gauge1
		.Caption(0) = .Layers.Item(Layer).OffsetX
	End With
End Function
</SCRIPT>

<OBJECT CLASSID="clsid:91628F12-393C-44EF-A558-83ED1790AAD3" id="Gauge1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With Gauge1
		.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
		.PicturesName = "`Layer` + int(value  + 1) + `.png`"
		.Layers.Count = 1
		With .Layers.Item(0)
			.OnDrag = 1
			.OffsetYValid = "0"
		End With
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

// Change event - Occurs when the layer's value is changed.
private void axGauge1_Change(object sender, AxEXGAUGELib._IGaugeEvents_ChangeEvent e)
{
	axGauge1.set_Caption(EXGAUGELib.PropertyLayerCaptionEnum.exLayerCaption,axGauge1.Layers[e.layer].OffsetX);
}
//this.axGauge1.Change += new AxEXGAUGELib._IGaugeEvents_ChangeEventHandler(this.axGauge1_Change);

axGauge1.PicturesPath = "C:\\Program Files (x86)\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob";
axGauge1.PicturesName = "`Layer` + int(value  + 1) + `.png`";
axGauge1.Layers.Count = 1;
EXGAUGELib.Layer var_Layer = axGauge1.Layers[0];
	var_Layer.OnDrag = EXGAUGELib.OnDragLayerEnum.exDoMove;
	var_Layer.OffsetYValid = "0";

X++ (Dynamics Ax 2009)

// Change event - Occurs when the layer's value is changed.
void onEvent_Change(int   _Layer)
{
	;
	exgauge1.Caption(0/*exLayerCaption*/,exgauge1.Layers().Item(_Layer).OffsetX());
}

public void init()
{
	COM com_Layer;
	anytype var_Layer;
	;

	super();

	exgauge1.PicturesPath("C:\\Program Files (x86)\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob");
	exgauge1.PicturesName("`Layer` + int(value  + 1) + `.png`");
	exgauge1.Layers().Count(1);
	var_Layer = COM::createFromObject(exgauge1.Layers()).Item(COMVariant::createFromInt(0)); com_Layer = var_Layer;
		com_Layer.OnDrag(1/*exDoMove*/);
		com_Layer.OffsetYValid("0");
}

Delphi 8 (.NET only)

// Change event - Occurs when the layer's value is changed.
procedure TWinForm1.AxGauge1_Change(sender: System.Object; e: AxEXGAUGELib._IGaugeEvents_ChangeEvent);
begin
	with AxGauge1 do
	begin
		set_Caption(EXGAUGELib.PropertyLayerCaptionEnum.exLayerCaption,TObject(Layers.Item[TObject(e.layer)].OffsetX));
	end
end;

with AxGauge1 do
begin
	PicturesPath := 'C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob';
	PicturesName := '`Layer` + int(value  + 1) + `.png`';
	Layers.Count := 1;
	with Layers.Item[TObject(0)] do
	begin
		OnDrag := EXGAUGELib.OnDragLayerEnum.exDoMove;
		OffsetYValid := '0';
	end;
end

Delphi (standard)

// Change event - Occurs when the layer's value is changed.
procedure TForm1.Gauge1Change(ASender: TObject; Layer : Integer);
begin
	with Gauge1 do
	begin
		Caption[EXGAUGELib_TLB.exLayerCaption] := OleVariant(Layers.Item[OleVariant(Layer)].OffsetX);
	end
end;

with Gauge1 do
begin
	PicturesPath := 'C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob';
	PicturesName := '`Layer` + int(value  + 1) + `.png`';
	Layers.Count := 1;
	with Layers.Item[OleVariant(0)] do
	begin
		OnDrag := EXGAUGELib_TLB.exDoMove;
		OffsetYValid := '0';
	end;
end

VFP

*** Change event - Occurs when the layer's value is changed. ***
LPARAMETERS Layer
	with thisform.Gauge1
		.Object.Caption(0) = .Layers.Item(Layer).OffsetX
	endwith

with thisform.Gauge1
	.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
	.PicturesName = "`Layer` + int(value  + 1) + `.png`"
	.Layers.Count = 1
	with .Layers.Item(0)
		.OnDrag = 1
		.OffsetYValid = "0"
	endwith
endwith

dBASE Plus

/*
with (this.EXGAUGEACTIVEXCONTROL1.nativeObject)
	Change = class::nativeObject_Change
endwith
*/
// Occurs when the layer's value is changed.
function nativeObject_Change(Layer)
	oGauge = form.EXGAUGEACTIVEXCONTROL1.nativeObject
	oGauge.Template = [Caption(0) = Layers.Item(Layer).OffsetX] // oGauge.Caption(0) = oGauge.Layers.Item(Layer).OffsetX
return

local oGauge,var_Layer

oGauge = form.EXGAUGEACTIVEXCONTROL1.nativeObject
oGauge.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
oGauge.PicturesName = "`Layer` + int(value  + 1) + `.png`"
oGauge.Layers.Count = 1
var_Layer = oGauge.Layers.Item(0)
	var_Layer.OnDrag = 1
	var_Layer.OffsetYValid = "0"

XBasic (Alpha Five)

' Occurs when the layer's value is changed.
function Change as v (Layer  as  N)
	oGauge = topparent:CONTROL_ACTIVEX1.activex
	oGauge.Template = "Caption(0) = Layers.Item(Layer).OffsetX" // oGauge.Caption(0) = oGauge.Layers.Item(Layer).OffsetX
end function

Dim oGauge as P
Dim var_Layer as P

oGauge = topparent:CONTROL_ACTIVEX1.activex
oGauge.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
oGauge.PicturesName = "`Layer` + int(value  + 1) + `.png`"
oGauge.Layers.Count = 1
var_Layer = oGauge.Layers.Item(0)
	var_Layer.OnDrag = 1
	var_Layer.OffsetYValid = "0"

Visual Objects

METHOD OCX_Exontrol1Change(Layer) CLASS MainDialog
	// Change event - Occurs when the layer's value is changed.
	oDCOCX_Exontrol1:[Caption,exLayerCaption] := oDCOCX_Exontrol1:Layers:[Item,Layer]:OffsetX
RETURN NIL

local var_Layer as ILayer

oDCOCX_Exontrol1:PicturesPath := "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
oDCOCX_Exontrol1:PicturesName := "`Layer` + int(value  + 1) + `.png`"
oDCOCX_Exontrol1:Layers:Count := 1
var_Layer := oDCOCX_Exontrol1:Layers:[Item,0]
	var_Layer:OnDrag := exDoMove
	var_Layer:OffsetYValid := "0"

PowerBuilder

/*begin event Change(long  Layer) - Occurs when the layer's value is changed.*/
/*
	oGauge = ole_1.Object
	oGauge.Caption(0,oGauge.Layers.Item(Layer).OffsetX)
*/
/*end event Change*/

OleObject oGauge,var_Layer

oGauge = ole_1.Object
oGauge.PicturesPath = "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
oGauge.PicturesName = "`Layer` + int(value  + 1) + `.png`"
oGauge.Layers.Count = 1
var_Layer = oGauge.Layers.Item(0)
	var_Layer.OnDrag = 1
	var_Layer.OffsetYValid = "0"

Visual DataFlex

// Occurs when the layer's value is changed.
Procedure OnComChange Integer   llLayer
	Forward Send OnComChange llLayer
	Variant v
	Variant voLayers
	Get ComLayers to voLayers
	Handle hoLayers
	Get Create (RefClass(cComLayers)) to hoLayers
	Set pvComObject of hoLayers to voLayers
		Variant voLayer
		Get ComItem of hoLayers llLayer to voLayer
		Handle hoLayer
		Get Create (RefClass(cComLayer)) to hoLayer
		Set pvComObject of hoLayer to voLayer
			Get ComOffsetX of hoLayer to v
		Send Destroy to hoLayer
	Send Destroy to hoLayers
	Set ComCaption OLEexLayerCaption to v
End_Procedure

Procedure OnCreate
	Forward Send OnCreate
	Set ComPicturesPath to "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
	Set ComPicturesName to "`Layer` + int(value  + 1) + `.png`"
	Variant voLayers1
	Get ComLayers to voLayers1
	Handle hoLayers1
	Get Create (RefClass(cComLayers)) to hoLayers1
	Set pvComObject of hoLayers1 to voLayers1
		Set ComCount of hoLayers1 to 1
	Send Destroy to hoLayers1
	Variant voLayers2
	Get ComLayers to voLayers2
	Handle hoLayers2
	Get Create (RefClass(cComLayers)) to hoLayers2
	Set pvComObject of hoLayers2 to voLayers2
		Variant voLayer1
		Get ComItem of hoLayers2 0 to voLayer1
		Handle hoLayer1
		Get Create (RefClass(cComLayer)) to hoLayer1
		Set pvComObject of hoLayer1 to voLayer1
			Set ComOnDrag of hoLayer1 to OLEexDoMove
			Set ComOffsetYValid of hoLayer1 to "0"
		Send Destroy to hoLayer1
	Send Destroy to hoLayers2
End_Procedure

XBase++

PROCEDURE OnChange(oGauge,Layer)
	oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:Layers:Item(Layer):OffsetX())
RETURN

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

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

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

	oGauge := XbpActiveXControl():new( oForm:drawingArea )
	oGauge:CLSID  := "Exontrol.Gauge.1" /*{91628F12-393C-44EF-A558-83ED1790AAD3}*/
	oGauge:create(,, {10,60},{610,370} )

		oGauge:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/

		oGauge:PicturesPath := "C:\Program Files (x86)\Exontrol\ExGauge\Sample\Design\Circular\Knob"
		oGauge:PicturesName := "`Layer` + int(value  + 1) + `.png`"
		oGauge:Layers():Count := 1
		oLayer := oGauge:Layers:Item(0)
			oLayer:OnDrag := 1/*exDoMove*/
			oLayer:OffsetYValid := "0"

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


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