Forum Discussion

praveen_l_singh's avatar
praveen_l_singh
Occasional Contributor
11 years ago
Solved

WPFObject grid


Hi,



I am unable to retrieve cell value from wpf object grid. Have tried different options but it didn't work. Object hirarchy is below. Can you pls suggest?



NameMapping.Sys.Process("Jpmc.Etrading.Mati.MainShell.Credit").WPFObject("HwndSource: XpfRibbonShellView", "Credit Insight NA UAT | 1.9.5.2361").WPFObject("XpfRibbonShellView", "Credit Insight NA UAT | 1.9.5.2361", 1).WPFObject("ContentControl", "", 1).WPFObject("Grid", "", 1).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 2).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 1).WPFObject("PART_ContainerContent").WPFObject("shellContent").WPFObject("Grid", "", 1).WPFObject("barManager").WPFObject("DockPanel", "", 1).WPFObject("mainWorkspace").WPFObject("dockLayoutManager").WPFObject("dockItem1").WPFObject("item6").WPFObject("item7").WPFObject("rootControl").WPFObject("Grid", "", 1).WPFObject("grid").WPFObject("gridView")


  • I was running in a similar problem with WPF testing.

    I ended up using the FileChild routine to drill down through a large number of levels.



    What I use is:

      Set toolgrid =  animPanel.FindChild("Name", "WPFObject(""Tool_Grid"")", 19)

      Set wpfHP =       toolgrid.FindChild("Name", "WPFObject(""Gauge_HP"")", 9)

      Set gaugeHP =     wpfHP.FindChild("Name", "WPFObject(""MyReading"")", 9)



    Where animPanel was preiously defined for the user control UI.

    The toolgrid is the top level of the WPF components within the animation pannel.

    The wpfHP is a branch top for the gauge I want to read.

    gaugeHP is where the actual value I want to read.



    I also found this to be 10 times faster to initilize than specifying a single, very long, Set statement.

    Don't ask me why it would be faster, I have a Forum topic started on the why.

    it also makes it easier to debug, less likely to break should the developer makes a change, and easier to read.



5 Replies

  • praveen_l_singh's avatar
    praveen_l_singh
    Occasional Contributor
    Thanks for the reply John, yes using Find is much faster in navigating the hierarchy.



    For handling WPPF grid for my application I was able to find 2 solutions (Thx to a Colleague);



    1)

    Set obj_Grid = NameMapping. .....WPFObject("grid")

    Set obj_Row = obj_Grid.DataSource.Item(0) ' Handle to row #1

    Msgbox obj_Row.WrappedObject.COLUMNNAME



    2)

    By adding the property value clrFullClassName of the WPFObject("grid") in

    Tools-> Current Project Properties -> Object Mapping:

    Developer Express Controls -> WPF -> GridControl



    After following above, WValue, WColumn etc properties are available for use and I am able to retrieve the value as below:

    Set obj_Grid = NameMapping. .....WPFObject("grid")

    Msgbox obj_Grid.WValue(2,2)



  • praveen_l_singh's avatar
    praveen_l_singh
    Occasional Contributor
    I have used methods like 

    1) wColumnCount, wColumn, wValue



    2)


    set x = NameMapping.Sys.Process("Jpmc.Etrading.Mati.MainShell.Credit").WPFObject("HwndSource: XpfRibbonShellView", "Credit Insight NA UAT | 1.9.5.2361").WPFObject("XpfRibbonShellView", "Credit Insight NA UAT | 1.9.5.2361", 1).WPFObject("ContentControl", "", 1).WPFObject("Grid", "", 1).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 2).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 1).WPFObject("PART_ContainerContent").WPFObject("shellContent").WPFObject("Grid", "", 1).WPFObject("barManager").WPFObject("DockPanel", "", 1).WPFObject("mainWorkspace").WPFObject("dockLayoutManager").WPFObject("dockItem1").WPFObject("item6").WPFObject("item7").WPFObject("rootControl").WPFObject("Grid", "", 1).WPFObject("grid").WPFObject("gridView")



    Set val = x.Items.Item(0).Item(2)



    msgbox val





    Pls suggest.


  • praveen_l_singh's avatar
    praveen_l_singh
    Occasional Contributor
    Looking at the methods, I see a method ;


    GetCellDisplayText(rowHandle as Integer, column as Object) as Object





    I tried using it as;

    1)GetCellDisplayText(1,"ColumnName")

    2)GetCellDisplayText(1,1)

    3)set obj1 = Namemapping.sys.....WPFObject("grid")

    Set obj2 = obj1.CreateColumn

    Msgbox GetCellDisplayText(1,obj2)



    All 3 didn't work.



    If I am on correct path, any suggestions on how would I pass column object?






     


  • hautzenroeder1's avatar
    hautzenroeder1
    Occasional Contributor
    I was running in a similar problem with WPF testing.

    I ended up using the FileChild routine to drill down through a large number of levels.



    What I use is:

      Set toolgrid =  animPanel.FindChild("Name", "WPFObject(""Tool_Grid"")", 19)

      Set wpfHP =       toolgrid.FindChild("Name", "WPFObject(""Gauge_HP"")", 9)

      Set gaugeHP =     wpfHP.FindChild("Name", "WPFObject(""MyReading"")", 9)



    Where animPanel was preiously defined for the user control UI.

    The toolgrid is the top level of the WPF components within the animation pannel.

    The wpfHP is a branch top for the gauge I want to read.

    gaugeHP is where the actual value I want to read.



    I also found this to be 10 times faster to initilize than specifying a single, very long, Set statement.

    Don't ask me why it would be faster, I have a Forum topic started on the why.

    it also makes it easier to debug, less likely to break should the developer makes a change, and easier to read.