Help with custom Delphi ComboBox
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2010
04:18 AM
04-20-2010
04:18 AM
Help with custom Delphi ComboBox
I am trying to come up with some code that will work to select a specified value from a drop-down list. This is a home-grown control (called TTPDualLookup) that was based on a DevExpress ComboBox control. I'm using VBScript.
The "DualLookup" seems to mean that the values in the drop down are concatenated from two sources (Vendor Code and Vendor Name, in this example). There are multiple objects for each combobox. The first is the one that contains the selection and also clicks to open the second object, which is the list that contains the concatenated objects.
I've attached a txt copy of a short script that selects a value based on screen position, but that's not going to work for us. Also a screen shot of the field.
Can anyone please help me get started on this? point me in the right direction? Explain why the vista.TcxPopupEditPopupWindow.TcxGrid object is at a higher level than the drop-down? and why it says it's a grid object when it really isn't? and how to look at the properties, methods, etc, of this object when they only display when the drop-down is activated (and it can not be activated when I leave the screen itself to look at the object browser).
Or -- even better - tell me how to actually DO this? (please?)
See the attachments and let me know if I need to go elsewhere with this?
Thanks.
Kathy
The "DualLookup" seems to mean that the values in the drop down are concatenated from two sources (Vendor Code and Vendor Name, in this example). There are multiple objects for each combobox. The first is the one that contains the selection and also clicks to open the second object, which is the list that contains the concatenated objects.
I've attached a txt copy of a short script that selects a value based on screen position, but that's not going to work for us. Also a screen shot of the field.
Can anyone please help me get started on this? point me in the right direction? Explain why the vista.TcxPopupEditPopupWindow.TcxGrid object is at a higher level than the drop-down? and why it says it's a grid object when it really isn't? and how to look at the properties, methods, etc, of this object when they only display when the drop-down is activated (and it can not be activated when I leave the screen itself to look at the object browser).
Or -- even better - tell me how to actually DO this? (please?)
See the attachments and let me know if I need to go elsewhere with this?
Thanks.
Kathy
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2010
03:02 AM
04-23-2010
03:02 AM
Hi Kathryn,
This behavior is programmed by the tested application developers.
Developers gave the TcxGrid class name to the control. It is equal to QuantumGrid's class name, and TC recognizes it as a grid.
Open the Object Properties window (see the "Object Properties Window" help topic), select "Select Object with Cursor", move your mouse over your control and once it is obtained by TC, press the shortcut (Tools | Options | Global | Global Shortcuts | Fix information) to fix the information.
First of all, make sure your application is compilled with debug info (see the "Debug Info Agent" help topic).
Here is a sample script:
If it does not work for you, let us know the name, vendor and version of your combo box control.
Explain why the vista.TcxPopupEditPopupWindow.TcxGrid object is at a higher level than the drop-down?
This behavior is programmed by the tested application developers.
and why it says it's a grid object when it really isn't?
Developers gave the TcxGrid class name to the control. It is equal to QuantumGrid's class name, and TC recognizes it as a grid.
and how to look at the properties, methods, etc, of this object when they only display when the drop-down is activated
Open the Object Properties window (see the "Object Properties Window" help topic), select "Select Object with Cursor", move your mouse over your control and once it is obtained by TC, press the shortcut (Tools | Options | Global | Global Shortcuts | Fix information) to fix the information.
how to actually DO this?
First of all, make sure your application is compilled with debug info (see the "Debug Info Agent" help topic).
Here is a sample script:
Sub Main
Dim wCombo, rowId, strCol
Set wCombo = <Path_To_Your_Combo_Box(FullName property value)>
rowId = <Row_Number>
strCol = "<Column>"
If clickItem(wCombo, rowId, strCol) Then
Log.Message "The [" & rowId & ", '" & strCol & "'] cell was successfully clicked."
End If
End Sub
Function clickItem(wCombo, rowId, strCol)
Dim p, wDropDown, rowCount, colCount, colId, bounds
Log.LockEvents(1)
Call wCombo.Click(wCombo.Width - wCombo.Height / 2, wCombo.Height / 2)
Set p = getProcess(wCombo)
Set wDropDown = <Path_To_Drop_Down_Form(FullName)>
rowCount = wDropDown.ViewInfo.Rows.Count
If rowId < 0 Or rowId > rowCount - 1 Then
Log.Error "Wrong row index."
clickItem = False
Exit Function
End If
colCount = wDropDown.ViewInfo.Rows.Items(rowId).Count
colId = getColIdByName(wDropDown, strCol)
If colId = -1 Then
Log.Error "Wrong column name."
clickItem = False
Exit Function
End If
Set bounds = wDropDown.ViewInfo.Rows.Items(rowId).Items(colId).Bounds
Call wDropDown.Click((bounds.Left + bounds.Right) / 2, (bounds.Top + bounds.Bottom) / 2)
Log.UnlockEvents
Log.Event "The [" & rowId & ", '" & strCol & "'] cell was clicked."
clickItem = True
End Function
Function getProcess(obj)
Do While Not IsSupported(obj, "ProcessName")
Set obj = obj.Parent
Loop
Set getProcess = obj
End Function
Function getColIdByName(wDropDown, strCol)
Dim colId, colCount, colObj
colCount = wDropDown.ViewInfo.Columns.Count
For colId = 0 To colCount - 1
Set colObj = wDropDown.ViewInfo.Columns.Items(colId)
If SameText(colObj.Text, strCol) Then
getColIdByName = colId
Exit Function
End If
Next
getColIdByName = -1
End Function
If it does not work for you, let us know the name, vendor and version of your combo box control.
-----
Alexander
Customer Care Manager
Alexander
Customer Care Manager
