Forum Discussion

Gethin's avatar
14 years ago

Wildcard Support within NameMappings

Hi



The application i am mapping has a series of identical controls that can appear on different tabs (all part of the same parent structure, a MFC tab control). Rather than map each control separately i want to map a single entry that works on whichever of the controls is visible (only 1 can be visible at any time). I was hoping that all i had to do was specify the classname as part of the mapping and it would pick up whichever of the controls was visible. Unfortunately this doesn't appear to be the case.



After further examination i noted that each of the controls has a static unique identifier (index or name property).



Name property value

Window("AfxFrameOrView90", "", 2)



I added this property as selected. I tried replacing the 2 with both * and ? and the application was still unable to locate the visible control, it would only work when the control where the mapping was applied was visible.



Is this an user implementation issue or don't wildcards work in this way?



I also have a second question regarding name mappings. Do mappings use hidden (or non specified properties) when attempting to highlight on screen?



Many thanks



Peter Mitcham

Sungard

2 Replies

  • It's hard to answer without seeing your application, but mapping by ClassName only should work, provided that all the instances of the control are all children of the same parent control (in other words the complete path to all the instances of the object should be identical), and provided that there are no other controls of the same class in the same part of the tree.

    But you don't describe how it is failing. Is it not finding any of the object instances? Or is it just not finding the one you want it to?



    Are all the instances of the object shown in the Object Browser at the same time, even when they are not visible on screen? If so, then mapping only by ClassName will result in it mapping the first object of that class that it finds, regardless of visibility. In that case you should add the Visible or VisibleOnScreen property to the mapping properties.



    You may also need to call Refresh or RefreshMappingInfo any time a different instance becomes visible.
  • Hi,



    Mapping by the Name property is not reliable. Use other properties - for example, WndClass.