MaskedTextBox


Display a Window containing a text box for user input - which must consist of three letters followed by four digits



XAML


∇  xaml←MaskedTextBoxXAML
⍝ XAML for the MaskedTextBox example
 xaml←⊂'<Window'
 xaml,←⊂'    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
 xaml,←⊂'    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
 xaml,←⊂'    xmlns:sftools="clr-namespace:Syncfusion.Windows.Shared;assembly=SyncFusion.Shared.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" >'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sftools:MaskedTextBox Name="mtbox"/>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>'


Code


∇  z←MaskedTextBox(mask value);⎕IO;⎕ML;xaml;⎕USING
⍝ Simple MaskedTextBox example
 ⎕IO ⎕ML←0 3
 ⎕USING←,⊂'System'
 xaml←MaskedTextBoxXAML
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_mtbox←#.window.FindName⊂'mtbox'
 window_mtbox.(Mask Value)←mask value
 {}#.window.ShowDialog
 z←window_mtbox.Value


The 'SyncTools' argument to #.UTIL.LoadXAML has the effect of adding

'Syncfusion.Windows.Shared,Syncfusion/4.5/Syncfusion.Shared.WPF.dll'
'SyncFusion.Windows.Tools.Controls,Syncfusion/4.5/Syncfusion.Tools.WPF.dll

 to the ⎕USING list of
LoadXAML

Operation


      #.MaskedTextBox.MaskedTextBox ( 'LLL0000' '')
ABC1234

Unresolved Issues


More sophisticated masking and validation, particularly use of regular expressions.