Tricky DevExpress.XtraGrid.GridControlNavigator co
This is my first posting here and please bear with me as it is going to be a lengthy post.
We are using DevExpress v2009 vol2 edition along iwth .NET 2008 3.5 SP1 framework and the tricky controls I'm dealing with are as follows:
This control has individual buttons for adding, deleting and duplicating rows. Clicking on the Add button would enable several text boxes under a different panel for adding a record. Once the user clicks on the Save button on the menu, the added record would be shown inside the DevExpress.XtraGrid.GridControlNavigator.
I tried several ways to get to the buttons but couldn't get a grip. I used the .NET Windows Forms Spy and was able to control the button clicks thru the spy which was neat and fast. I wish I would be able to it with that much ease. I was wondering how the .NET Windows Forms Spy would be able to do it easily. The following code is what I used to get to the button level:
Set obj = SwfWindow("Name:=Form1").SwfObject("swftypename:=D evExpress.XtraGrid.GridControlNavigator")
Inspecting the obj variable in the debug watch window displays several methods (e.g) CaptureBitmap(), Check(), CheckProperty(), ChildObjects() etc. Also, collapsing the Methods tree, showed two more properties: Exist and Object. Exist displays False and Object displays Nothing. I guess the Object property is used in getting into the .NET methods and events. I'm surprised to see that Object property is Nothing. Can anybody tell me why?
Having said that, how is the .NET Windows Forms Spy able to dig deeper into the control and get to all the buttons thru CustomButtons property of type Collection. Also, I monitored for events being generated by the control when the + sign (to Add record) is clicked. I found that the control is generating "ButtonClick" event with the second parameter set to the Tag property like this:
private void GridControlWithNavigator1_NavigatorButtonClick(obj ect sender, DevExpress.XtraEditors.NavigatorButtonClickEventAr gs e)
InsertPerson(); // private method inside the app
e.Handled = true;
I tried firing this event from QTP using the "FireEvent" method but don't know for sure what the correct syntax is.
I don't want to go thru the .NET Extensibility route as it is time consuming and complicated.
What are my options here? If I can convince the developers to add public methods for Adding/Deleting/Duplicating records for the correspondng buttons, will the Object property not be Nothing and will the approach work?
Please let me know as it is critical that this feature in the app need to be automated.
Re: Tricky DevExpress.XtraGrid.GridControlNavigator co
Couple of more things:
a. If I do this: Dim obj2
Set obj2 = SwfWindow("Name:=Form1").SwfObject("swftypename:=D evExpress.XtraGrid.GridControlNavigator").Object
the debug watch window shows obj2 as type Object but doesn't allow me to expand further.
b. Also, the Add/Delete/Duplicate buttons I wss mentioning seems to be embedded inside the DevExpress.XtraGrid.GridControlNavigator control.
c. I wanted to ask this: When using .NET Windows Forms Spy, I'm seeing a "CustomButtons" property. Expanding it shows those three buttons I was mentioning and I was able to manipulate them from within the spy. I wanted to call the "CustomButtons" collections property from code. How do I do that?