:Namespace sfDoubleTextBox
⍝ === VARIABLES ===
L←⎕av[3+⎕io]
_←⍬
_,←''
_,←L,''
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,''
_,←L,''
Warning_ToolTip_xaml←_
_←⍬
_,←''
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,' '
_,←L,''
sfDoubleTextBoxDemo1_xaml←_
⎕ex¨ 'L' '_'
⍝ === End of variables definition ===
(⎕IO ⎕ML ⎕WX)←1 3 3
∇ DemoDoubleTextBox1;sfDir;⎕USING
⍝ Demo of DataValidation on Lost Focus for a Syncfusion DoubleTextBox using their MinValue and MaxValue properties.
sfDir ← 'Syncfusion/4.5/' ⍝ Location of the Syncfusion librairies
⎕USING ← 'System.Windows.Controls,WPF/PresentationFramework.dll'
⎕USING,← ⊂'Syncfusion.Windows.Shared,',sfDir,'Syncfusion.Shared.Wpf.dll'
:Trap 0
{}DoubleTextBox ⍝ Syncfusion DoubleTextBox object should be available.
:Else
⎕←'DemoDoubleTextBox: Error loading the assembly Syncfusion.Shared.Wpf.dll.'
→0
:End
⍝ Compile the Xaml:
sfDoubleTextBoxDemo_obj←FixSimpleXaml sfDoubleTextBoxDemo1_xaml
⍝ Attach manually the events:
sfDoubleTextBoxDemo_obj.doubleTextBox1.onValueChanged ← '_DoubleTextBox_ValueChangedEvent'
sfDoubleTextBoxDemo_obj.doubleTextBox2.onValueChanged ← '_DoubleTextBox_ValueChangedEvent'
sfDoubleTextBoxDemo_obj.buttonCancel.onClick ← '_ButtonCancel_ClickEvent'
sfDoubleTextBoxDemo_obj.buttonOk.onClick ← '_ButtonOk_ClickEvent'
⍝ Show the window:
sfDoubleTextBoxDemo_obj.Show
∇
∇ rootObject←FixSimpleXaml xaml;names;⎕USING
⍝ Parse simple Xaml that contains only names to fix.
⍝ Parse the simple Xaml and obtain the root object:
⎕USING ← 'System.Windows.Markup,WPF/PresentationFramework.dll'
rootObject ← XamlReader.Parse(⊂xaml)
⍝ Extract the names beginning with 'x:Name':
names ← {{(,⊃0≠⍴¨⍵)/⍵}{1⊃((⍵[;1]∊⊂'x:Name')/⍵[;2]),⊂''}¨(⎕XML ⍵)[;4]}xaml
⍝ Assign the value of each names to the root object:
rootObject {⍎'⍺.',⍵,'←⍺.FindName(⊂⍵)'} ¨names
∇
∇ _ButtonCancel_ClickEvent(sender event)
⍝ Click Event Handler for the Cancel Button.
⍝ Close the Parent Window.
sfDoubleTextBoxDemo_obj.Close
∇
∇ _ButtonOk_ClickEvent(sender event)
⍝ Click Event Handler for the OK Button.
⍝ Show the validated values of the form.
⎕ ← sfDoubleTextBoxDemo_obj.(doubleTextBox1 doubleTextBox2).Value
⍝ Close the Parent Window.
sfDoubleTextBoxDemo_obj.Close
∇
∇ _DoubleTextBox_ValueChangedEvent(sender event);maxValue;message;minValue;value;⎕USING
⍝ ValueChanged Event Handler OnLostFocus for a Syncfusion DoubleTextBox.
⍝ It Will Show a ToolTip if the Value of the DoubleTextBox Exceed the Maximum or the Minimum Value Range.
⍝
⍝ sender = Syncfusion.Windows.Shared.DoubleTextBox
⍝ event = System.Windows.DependencyPropertyChangedEventArgs
(value minValue maxValue) ← sender.(Value MinValue MaxValue)
:If (value≤maxValue)∧(value≥minValue)
⍝ The Value is Within the Maximum and Minimum Value Range.
⍝ Remove Any Visible ToolTip and Reset the Background and Foreground Property to Default Value.
:Trap 0
sender.ToolTip.IsOpen ← 0
⍝ Reset the Background, Foreground and ToolTip properties of sender to it's default value.
⎕USING ← 'System.Windows.Controls,WPF/PresentationFramework.dll'
sender.ClearValue¨TextBox.(BackgroundProperty ForegroundProperty ToolTipProperty)
:Else
⍝ Error because there is no ToolTip define for the sender. Do nothing.
:EndTrap
:Else
⍝ The Value is Not Within the Maximum and Minimum Value Range.
⍝ Prepare the Warning Message:
:If valuemaxValue
message ← ('¯'⎕R'-')'The Value is Too Large.',(⎕UCS 13),'It Must be Smaller Than ',(⍕maxValue),'.'
:EndIf
⍝ Show a ToolTip with the Warning Message.
:Trap 0
⍝ Will bug if empty. If there is already a ToolTip, reuse it.
sender.ToolTip.(FindName⊂'warning').Content ← message
:Else
⍝ No ToolTip. Create it for the first time.
⎕USING ← 'System.Windows.Markup,WPF/PresentationFramework.dll'
sender.ToolTip ← XamlReader.Parse(⊂Warning_ToolTip_xaml)
sender.ToolTip.(FindName⊂'tooltip').PlacementTarget ← sender
sender.ToolTip.(FindName⊂'warning').Content ← message
:EndTrap
⍝ Force the ToolTip to Show and to stay visible.
sender.ToolTip.(IsOpen StaysOpen) ← 1
⍝ Change the Foreground and Background color of sender to indicate that there is a warning tooltip.
⎕USING ← 'System.Windows.Media,WPF/PresentationCore.dll'
sender.(Background Foreground) ← ⎕NEW¨SolidColorBrush,¨(Colors.Red)(Colors.White)
:End
∇
:EndNamespace