asdfasdfasdfasd
15 years agoContributor
Cannot call .NET method for object returned by FindChild
I have an interesting scenario where I'm unable to call a .NET method for an object returned by FindChild, but can call the same .NET method if I reference the object fully.
Here's the code that works:
var obj =
NameMapping.Sys.pCatalyst.hwndWave.wWave.wavectrlMain.dpnlWave.WPFObject("Grid",
"", 1).WPFObject("mFrame").WPFObject("DefaultQuickWavePage", "",
1).WPFObject("StackPanel", "",
1).WPFObject("mQuickWaveControl").WPFObject("StackPanel", "",
1).WPFObject("StackPanel", "", 2).WPFObject("StackPanel", "",
1).WPFObject("mLimitPriceControl").WPFObject("StackPanel", "",
1).WPFObject("mComboBoxLimitType");
obj.SelectItemWithValue(obj.Items.Item(0));
Here's the code that does not work:
var obj = NameMapping.Sys.pCatalyst.hwndWave.FindChild("NativeClrObject.Name", "mComboBoxLimitType", 14);
obj.SelectItemWithValue(obj.Items.Item(0));
The .NET method in question is SelectItemWithValue, but I'm sure it affects all .NET methods.
Here's the code that works:
var obj =
NameMapping.Sys.pCatalyst.hwndWave.wWave.wavectrlMain.dpnlWave.WPFObject("Grid",
"", 1).WPFObject("mFrame").WPFObject("DefaultQuickWavePage", "",
1).WPFObject("StackPanel", "",
1).WPFObject("mQuickWaveControl").WPFObject("StackPanel", "",
1).WPFObject("StackPanel", "", 2).WPFObject("StackPanel", "",
1).WPFObject("mLimitPriceControl").WPFObject("StackPanel", "",
1).WPFObject("mComboBoxLimitType");
obj.SelectItemWithValue(obj.Items.Item(0));
Here's the code that does not work:
var obj = NameMapping.Sys.pCatalyst.hwndWave.FindChild("NativeClrObject.Name", "mComboBoxLimitType", 14);
obj.SelectItemWithValue(obj.Items.Item(0));
The .NET method in question is SelectItemWithValue, but I'm sure it affects all .NET methods.