excalcedit - sample code

How can I display the result on the right side of the control?

VBA (MS Access, Excell...)

With CalcEdit1
	.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
	.Text = "12 + (12 / 100)/2"
End With

VB6

With CalcEdit1
	.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
	.Text = "12 + (12 / 100)/2"
End With

VB.NET

With Excalcedit1
	.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
	.Text = "12 + (12 / 100)/2"
End With

VB.NET for /COM

With AxCalcEdit1
	.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
	.Text = "12 + (12 / 100)/2"
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'ExCALCEDITLib' for the library: 'ExCalcEdit 1.0 Control Library'

	#import <ExCalcEdit.dll>
*/
ExCALCEDITLib::ICalcEditPtr spCalcEdit1 = GetDlgItem(IDC_CALCEDIT1)->GetControlUnknown();
spCalcEdit1->PutFormatResult(L"<r> <fgcolor=808080>[=%%]</fgcolor>");
spCalcEdit1->PutText(L"12 + (12 / 100)/2");

C++ Builder

CalcEdit1->FormatResult = L"<r> <fgcolor=808080>[=%%]</fgcolor>";
CalcEdit1->Text = L"12 + (12 / 100)/2";

C#

excalcedit1.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>";
excalcedit1.Text = "12 + (12 / 100)/2";

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:0D4EE794-3E13-4226-81F9-499EE6EDCCF7" id="CalcEdit1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	CalcEdit1.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>";
	CalcEdit1.Text = "12 + (12 / 100)/2";
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:0D4EE794-3E13-4226-81F9-499EE6EDCCF7" id="CalcEdit1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With CalcEdit1
		.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
		.Text = "12 + (12 / 100)/2"
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

axCalcEdit1.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>";
axCalcEdit1.Text = "12 + (12 / 100)/2";

X++ (Dynamics Ax 2009)

public void init()
{
	;

	super();

	excalcedit1.FormatResult("<r> <fgcolor=808080>[=%%]</fgcolor>");
	excalcedit1.Text("12 + (12 / 100)/2");
}

Delphi 8 (.NET only)

with AxCalcEdit1 do
begin
	FormatResult := '<r> <fgcolor=808080>[=%%]</fgcolor>';
	Text := '12 + (12 / 100)/2';
end

Delphi (standard)

with CalcEdit1 do
begin
	FormatResult := '<r> <fgcolor=808080>[=%%]</fgcolor>';
	Text := '12 + (12 / 100)/2';
end

VFP

with thisform.CalcEdit1
	.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
	.Text = "12 + (12 / 100)/2"
endwith

dBASE Plus

local oCalcEdit

oCalcEdit = form.EXCALCEDITACTIVEXCONTROL1.nativeObject
oCalcEdit.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
oCalcEdit.Text = "12 + (12 / 100)/2"

XBasic (Alpha Five)

Dim oCalcEdit as P

oCalcEdit = topparent:CONTROL_ACTIVEX1.activex
oCalcEdit.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
oCalcEdit.Text = "12 + (12 / 100)/2"

Visual Objects


oDCOCX_Exontrol1:FormatResult := "<r> <fgcolor=808080>[=%%]</fgcolor>"
oDCOCX_Exontrol1:Text := "12 + (12 / 100)/2"

PowerBuilder

OleObject oCalcEdit

oCalcEdit = ole_1.Object
oCalcEdit.FormatResult = "<r> <fgcolor=808080>[=%%]</fgcolor>"
oCalcEdit.Text = "12 + (12 / 100)/2"

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComFormatResult to "<r> <fgcolor=808080>[=%%]</fgcolor>"
	Set ComText to "12 + (12 / 100)/2"
End_Procedure

XBase++

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

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

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

	oCalcEdit := XbpActiveXControl():new( oForm:drawingArea )
	oCalcEdit:CLSID  := "Exontrol.CalcEdit.1" /*{0D4EE794-3E13-4226-81F9-499EE6EDCCF7}*/
	oCalcEdit:create(,, {10,60},{610,370} )

		oCalcEdit:FormatResult := "<r> <fgcolor=808080>[=%%]</fgcolor>"
		oCalcEdit:Text := "12 + (12 / 100)/2"

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