jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

MsUia::ValueControl Accessor #56

Closed leviwilson closed 11 years ago

leviwilson commented 11 years ago

For the :ms_uia adapter there was no way to directly work with a control that simply supports the ValuePattern. I've added a generic ValueControl class to be able to get and set values of a control that supports this UIA pattern.

leviwilson commented 11 years ago

@jarmo You had a chance to look at this yet?

jarmo commented 11 years ago

Sorry for not looking at it before. I have just been too busy lately :(

Spec fails for me:

MsUia::ValueControl

Unhandled Exception: System.FormatException: String was not recognized as a valid DateTime.
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at WindowsForms.MonthCalendarAutomationProvider.SetValue(String value) in c:\Users\Jarmo\Documents\Projects\Ruby\RAutomation\ext\WindowsForms\WindowsForms\AutomatableMonthCalendar.cs:line 48
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at MS.Internal.Automation.UiaCoreApi.CheckError(Int32 hr)
   at System.Windows.Automation.ValuePattern.SetValue(String value)
   at AutomationControl.set_Value(String value) in c:\users\jarmo\documents\projects\ruby\rautomation\ext\uiadll\uiadll\automationcontrol.cpp:line
 11
   at Control_SetValue(HWND__* windowHandle, SByte* theValue) in c:\users\jarmo\documents\projects\ruby\rautomation\ext\uiadll\uiadll\controlmethods.cpp:line 13
rake aborted!

The problem is that the control seems to be taking account system locale/regional settings. This is how it looks for me: image

leviwilson commented 11 years ago

See if bc23917 fixes that for you. Worked for my en-US system, but we'll see :-)

jarmo commented 11 years ago

That did the trick. Thanks!