This is a migrated thread and some comments may be shown as answers.

Funny error with RadMaskedNumericInput

2 Answers 119 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Deng
Top achievements
Rank 1
Deng asked on 21 Nov 2012, 06:06 AM
Hi Telerik,

When I used the control that combine RadCombobox and RadMaskedNumericInput, the application will crash....

<telerik:RadMaskedNumericInput Grid.Column="1"
                                       Grid.Row="1"
                                       Mask="#2"
                                       IsLastPositionEditable="False"
                                       />
 
        <telerik:RadComboBox   Grid.Column="2"
                               Grid.Row="1"
                                
                               
                               ItemsSource="{Binding LnamEntityCollection}"
                               DisplayMemberPath="LNAM"
                               SelectedValuePath="ModelId"></telerik:RadComboBox>
Code is very very simple, I discovered this bug via below steps.
1. Input some chinese into Radcombobox for filtering.
2.  Input some numbers to telerik:RadMaskedNumericInput , for now  telerik:RadMaskedNumericInput  can not work correctly, if you make cursor in begining and then
 input some numbers(should beyond the masked number), the error will be got.

 startIndex cannot be larger than length of string.
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at System.String.Substring(Int32 startIndex)
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessKey(Char ch) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 1571
   at Telerik.Windows.Controls.RadMaskedInputBase.OnKeyDownHandled(Char c) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 500
   at Telerik.Windows.Controls.MaskedInput.PreviewInputTextBox.OnTextInput(TextCompositionEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\PreviewInputTextBox.cs:line 53
   at System.Windows.UIElement.OnTextInputThunk(Object sender, TextCompositionEventArgs e)
   at System.Windows.Input.TextCompositionEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.TextCompositionManager.UnsafeCompleteComposition(TextComposition composition)
   at System.Windows.Documents.ImmComposition.RaiseTextInputEvent(FrameworkTextComposition composition, String compositionString)
   at System.Windows.Documents.ImmComposition.OnWmImeChar(IntPtr wParam, Boolean& handled)
   at System.Windows.Documents.ImmComposition.ImmCompositionFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at RadControlsWpfApp1.App.Main() in c:\users\administrator\documents\visual studio 2010\Projects\RadControlsWpfApp1\RadControlsWpfApp1\obj\x86\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

How to solve it????

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 23 Nov 2012, 11:41 AM
Hi Deng,

Let me make a quick clarification first. The RadmaskedNumericInput expects input of type Double and if you try to input some string or some kind of char type, unexpected behavior may occur.

We are not sure how do you reproduce this issue. Can you please elaborate on your scenario? Is the RadComboBox control somehow related to the RadMaskedNumericInput? It will be best if you send us a sample runnable project so we can investigate this issue. Thank you for your cooperation.

All the best,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Deng
Top achievements
Rank 1
answered on 23 Nov 2012, 01:07 PM
Hi Telerik,

Thanks for your replying. I have found the reason that if I input some Chinese by using Google pinyin input software  
in combobox, it will make RadMaskedNumericInput work error, I have switched to other input software , the error went away...
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Deng
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Deng
Top achievements
Rank 1
Share this question
or