Forum Discussion

qadude73's avatar
qadude73
Occasional Contributor
10 months ago

How to get a specific value from a specific grid row, column using Python?

I've been trying to get a value from a grid's specific location (row, column) using Python but seems to struggle finding the correct method. So far, the closest method I found is .SelectItem(), but it returns the row's entire value as one long string without white spaces. In javascript, I was easily able to achieve this using the .wItem(row, column) method. Would appreciate any leads.

  • It's been ages since I last worked with MFC, and I can't remember if MFC has a grid control. Anyway, you have various properties, and one of them is wItem. If you were to provide appropriate parameter(s) to wItem, then TC may be able to retrieve the exact data.

     

    The properties shown, it should be possible to retrieve the data you require, but you will have to play around with the properties and parameter(s) values!

     

4 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What properties and methods are exposed when you use Object Spy on your control?

    • qadude73's avatar
      qadude73
      Occasional Contributor

      rraghvani, Here are the Extended Properties and as far as Methods, there's a long list of MFC methods for CCmdTarget_xxx, CObject_xxx and CWnd_xxx. When I do a keyword search for, "get", the methods I get back are from the CWnd_xxx list. I've tried "object.CWnd_GetWindowTextA1()" using the expected strings as params but doesn't seem to work. I maybe using this method incorrectly, though.

       

      Fig 1 - Object's Extended Properties

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    It's been ages since I last worked with MFC, and I can't remember if MFC has a grid control. Anyway, you have various properties, and one of them is wItem. If you were to provide appropriate parameter(s) to wItem, then TC may be able to retrieve the exact data.

     

    The properties shown, it should be possible to retrieve the data you require, but you will have to play around with the properties and parameter(s) values!

     

    • qadude73's avatar
      qadude73
      Occasional Contributor

      rraghvani, thanks for reiterating the use of wItem. I encountered errors on this when I first started using it then realized that I was using it as wItem( ) instead of wItem[ ] since I was scripting in Python.