exmaskedit - sample code

How can I specify multiple masks?

VBA (MS Access, Excell...)

With MaskEdit1
	.InsertMode = 1
	.SelectGotFocus = 1
	.VisibleMasks = 6
	.TextIncludeLiterals = 2
	.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" & _
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
	.Text = "845 0287"
	.ActiveMask = 1
End With

VB6

With MaskEdit1
	.InsertMode = exEditOvertypeMode
	.SelectGotFocus = exSelectAllGotFocus
	.VisibleMasks = 6
	.TextIncludeLiterals = exClipModeLiteralsExclude
	.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" & _
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
	.Text = "845 0287"
	.ActiveMask = 1
End With

VB.NET

With Exmaskedit1
	.InsertMode = exontrol.EXMASKEDITLib.InsertModeEnum.exEditOvertypeMode
	.SelectGotFocus = exontrol.EXMASKEDITLib.SelectGotFocusEnum.exSelectAllGotFocus
	.VisibleMasks = 6
	.TextIncludeLiterals = exontrol.EXMASKEDITLib.ClipModeLiteralsEnum.exClipModeLiteralsExclude
	.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" & _
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
	.Text = "845 0287"
	.ActiveMask = 1
End With

VB.NET for /COM

With AxMaskEdit1
	.InsertMode = EXMASKEDITLib.InsertModeEnum.exEditOvertypeMode
	.SelectGotFocus = EXMASKEDITLib.SelectGotFocusEnum.exSelectAllGotFocus
	.VisibleMasks = 6
	.TextIncludeLiterals = EXMASKEDITLib.ClipModeLiteralsEnum.exClipModeLiteralsExclude
	.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" & _
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
	.Text = "845 0287"
	.ActiveMask = 1
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXMASKEDITLib' for the library: 'ExMaskEdit 7.1 Control Library'

	#import <MaskEdit.dll>
	using namespace EXMASKEDITLib;
*/
EXMASKEDITLib::IMaskEditPtr spMaskEdit1 = GetDlgItem(IDC_MASKEDIT1)->GetControlUnknown();
spMaskEdit1->PutInsertMode(EXMASKEDITLib::exEditOvertypeMode);
spMaskEdit1->PutSelectGotFocus(EXMASKEDITLib::exSelectAllGotFocus);
spMaskEdit1->PutVisibleMasks(6);
spMaskEdit1->PutTextIncludeLiterals(EXMASKEDITLib::exClipModeLiteralsExclude);
spMaskEdit1->PutMasks(_bstr_t("Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`") +
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000");
spMaskEdit1->PutText(L"845 0287");
spMaskEdit1->PutActiveMask(1);

C++ Builder

MaskEdit1->InsertMode = Exmaskeditlib_tlb::InsertModeEnum::exEditOvertypeMode;
MaskEdit1->SelectGotFocus = Exmaskeditlib_tlb::SelectGotFocusEnum::exSelectAllGotFocus;
MaskEdit1->VisibleMasks = 6;
MaskEdit1->TextIncludeLiterals = Exmaskeditlib_tlb::ClipModeLiteralsEnum::exClipModeLiteralsExclude;
MaskEdit1->Masks = TVariant(String("Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`") +
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000");
MaskEdit1->Text = L"845 0287";
MaskEdit1->ActiveMask = 1;

C#

exmaskedit1.InsertMode = exontrol.EXMASKEDITLib.InsertModeEnum.exEditOvertypeMode;
exmaskedit1.SelectGotFocus = exontrol.EXMASKEDITLib.SelectGotFocusEnum.exSelectAllGotFocus;
exmaskedit1.VisibleMasks = 6;
exmaskedit1.TextIncludeLiterals = exontrol.EXMASKEDITLib.ClipModeLiteralsEnum.exClipModeLiteralsExclude;
exmaskedit1.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" +
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000";
exmaskedit1.Text = "845 0287";
exmaskedit1.ActiveMask = 1;

JavaScript

<OBJECT classid="clsid:43F80262-F652-11D3-AD39-00C0DFC59237" id="MaskEdit1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	MaskEdit1.InsertMode = 1;
	MaskEdit1.SelectGotFocus = 1;
	MaskEdit1.VisibleMasks = 6;
	MaskEdit1.TextIncludeLiterals = 2;
	MaskEdit1.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" +
	" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000";
	MaskEdit1.Text = "845 0287";
	MaskEdit1.ActiveMask = 1;
</SCRIPT>

C# for /COM

axMaskEdit1.InsertMode = EXMASKEDITLib.InsertModeEnum.exEditOvertypeMode;
axMaskEdit1.SelectGotFocus = EXMASKEDITLib.SelectGotFocusEnum.exSelectAllGotFocus;
axMaskEdit1.VisibleMasks = 6;
axMaskEdit1.TextIncludeLiterals = EXMASKEDITLib.ClipModeLiteralsEnum.exClipModeLiteralsExclude;
axMaskEdit1.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1`" +
" 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000";
axMaskEdit1.Text = "845 0287";
axMaskEdit1.ActiveMask = 1;

X++ (Dynamics Ax 2009)

public void init()
{
	str var_s;
	;

	super();

	exmaskedit1.InsertMode(1/*exEditOvertypeMode*/);
	exmaskedit1.SelectGotFocus(1/*exSelectAllGotFocus*/);
	exmaskedit1.VisibleMasks(6);
	exmaskedit1.TextIncludeLiterals(2/*exClipModeLiteralsExclude*/);
	var_s = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` ";
	var_s = var_s + "999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000";
	exmaskedit1.Masks(var_s);
	exmaskedit1.Text("845 0287");
	exmaskedit1.ActiveMask(1);
}

Delphi 8 (.NET only)

with AxMaskEdit1 do
begin
	InsertMode := EXMASKEDITLib.InsertModeEnum.exEditOvertypeMode;
	SelectGotFocus := EXMASKEDITLib.SelectGotFocusEnum.exSelectAllGotFocus;
	VisibleMasks := 6;
	TextIncludeLiterals := EXMASKEDITLib.ClipModeLiteralsEnum.exClipModeLiteralsExclude;
	Masks := 'Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` ' + 
	'999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000';
	Text := '845 0287';
	ActiveMask := 1;
end

Delphi (standard)

with MaskEdit1 do
begin
	InsertMode := EXMASKEDITLib_TLB.exEditOvertypeMode;
	SelectGotFocus := EXMASKEDITLib_TLB.exSelectAllGotFocus;
	VisibleMasks := 6;
	TextIncludeLiterals := EXMASKEDITLib_TLB.exClipModeLiteralsExclude;
	Masks := 'Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` ' + 
	'999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000';
	Text := '845 0287';
	ActiveMask := 1;
end

VFP

with thisform.MaskEdit1
	.InsertMode = 1
	.SelectGotFocus = 1
	.VisibleMasks = 6
	.TextIncludeLiterals = 2
	var_s = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` "
	var_s = var_s + "999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
	.Masks = var_s
	.Text = "845 0287"
	.ActiveMask = 1
endwith

dBASE Plus

local oMaskEdit

oMaskEdit = form.Activex1.nativeObject
oMaskEdit.InsertMode = 1
oMaskEdit.SelectGotFocus = 1
oMaskEdit.VisibleMasks = 6
oMaskEdit.TextIncludeLiterals = 2
oMaskEdit.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
oMaskEdit.Text = "845 0287"
oMaskEdit.ActiveMask = 1

XBasic (Alpha Five)

Dim oMaskEdit as P

oMaskEdit = topparent:CONTROL_ACTIVEX1.activex
oMaskEdit.InsertMode = 1
oMaskEdit.SelectGotFocus = 1
oMaskEdit.VisibleMasks = 6
oMaskEdit.TextIncludeLiterals = 2
oMaskEdit.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
oMaskEdit.Text = "845 0287"
oMaskEdit.ActiveMask = 1

Visual Objects


oDCOCX_Exontrol1:InsertMode := exEditOvertypeMode
oDCOCX_Exontrol1:SelectGotFocus := exSelectAllGotFocus
oDCOCX_Exontrol1:VisibleMasks := 6
oDCOCX_Exontrol1:TextIncludeLiterals := exClipModeLiteralsExclude
oDCOCX_Exontrol1:Masks := "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
oDCOCX_Exontrol1:Text := "845 0287"
oDCOCX_Exontrol1:ActiveMask := 1

PowerBuilder

OleObject oMaskEdit

oMaskEdit = ole_1.Object
oMaskEdit.InsertMode = 1
oMaskEdit.SelectGotFocus = 1
oMaskEdit.VisibleMasks = 6
oMaskEdit.TextIncludeLiterals = 2
oMaskEdit.Masks = "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
oMaskEdit.Text = "845 0287"
oMaskEdit.ActiveMask = 1

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComInsertMode to OLEexEditOvertypeMode
	Set ComSelectGotFocus to OLEexSelectAllGotFocus
	Set ComVisibleMasks to 6
	Set ComTextIncludeLiterals to OLEexClipModeLiteralsExclude
	Set ComMasks to "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
	Set ComText to "845 0287"
	Set ComActiveMask to 1
End_Procedure

XBase++

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

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

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

	oMaskEdit := XbpActiveXControl():new( oForm:drawingArea )
	oMaskEdit:CLSID  := "Exontrol.MaskEdit.1" /*{43F80262-F652-11D3-AD39-00C0DFC59237}*/
	oMaskEdit:create(,, {10,60},{610,370} )

		oMaskEdit:InsertMode := 1/*exEditOvertypeMode*/
		oMaskEdit:SelectGotFocus := 1/*exSelectAllGotFocus*/
		oMaskEdit:VisibleMasks := 6
		oMaskEdit:TextIncludeLiterals := 2/*exClipModeLiteralsExclude*/
		oMaskEdit:Masks := "Local;!000-0000|Domestic;!(999) 000-0000|International;!`+1` 999-000-0000|Dialed in the US;!`1` 999-000-0000|Dialed from Germany;!`001` 999-000-0000|Dialed from France;!`191` 999-000-0000"
		oMaskEdit:Text := "845 0287"
		oMaskEdit:ActiveMask := 1

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