DoubleTextBox


Display a Window containing a DoubleTextBox which allows the user to input values within a specified range, returning the value when the Window is closed.



XAML


∇  xaml←DoubleTextBoxXAML
⍝ XAML for the DoubleTextBox 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:IntegerTextBox Name="dtbox"/>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>' 



Code


∇  z←DoubleTextBox(val range);⎕IO;⎕ML;xaml;⎕USING
⍝ Simple DoubleTextBox example
 ⎕IO ⎕ML←0 3
 ⎕USING←,⊂'System'
 xaml←DoubleTextBoxXAML
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_dtbox←#.window.FindName⊂'dtbox'
 window_dtbox.(Value MinValue MaxValue)←{Convert.ToInt64 ⍵}¨val,∊range
 {}#.window.ShowDialog
 z←Convert.ToInt32 window_dtbox.Value 



Quite why this is called some sort of "TextBox" rather than (say) "NumberBox" escapes me...

Notice also the aggravation involved in dealing with the Double number type.

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


       #.DoubleTextBox.DoubleTextBox 50 (40 60)
44

Unresolved Issues