Jump to content

Custom Control roadblock...


Recommended Posts

Ok, let's try a variant of the problem. I can now scroll through the LV control and extract text from each Item, which automatically selects each Item for the duration of the loop. Not a big deal.

However, when I attempt to Click on that Item, I cannot get the control to respond. To wit...

CODE

Func Customize_Perspective()

; Raise the "Customize Perspective" panel...

WinMenuSelectItem("J2EE - IBM Rational Software Development Platform", "", "&Window", "Customi&ze Perspective..." )

; Focus on the "Customize Perspective" panel...

WinWait("Customize Perspective", "")

WinActivate("Customize Perspective", "")

; The default tab is "Shortcuts", but we need to be on the "Commands" tab...

Send("+{TAB}{RIGHT}")

; We need to process the "Available Command Groups" SysListView control, SysListView322...

ControlFocus("Customize Perspective", "", "SysListView322")

; Define an output text file to record debugging processes...

$hDisplayFile = 'L:\ITWebSysDoc\Version Control\AutoIt Stuff\AutoIt v3\Script Examples\StarTeamRAD6InterfaceTest\DebugDisplay.txt'

FileClose(FileOpen($hDisplayFile, 10))

Local $hDisplay = 'Results of walking through the SysListView322 Controls: ' & @CRLF & @CRLF

; Scan the SysListView322 control...

$nLVCHwnd = _Determine_Control_Info("Customize Perspective")

$nLVTotal = ControlListView("Customize Perspective", "", "SysListView322", "GetItemCount")

$hDisplay &= " ---------------------- " & @CRLF

$hDisplay &= " Control handle is " & $nLVCHwnd & @CRLF

$hDisplay &= " Number of Items is " & $nLVTotal & @CRLF

$hDisplay &= " ---------------------- " & @CRLF & @CRLF

; Locate any/all StarTeam items and see what their status is -- and set them "ON"...

For $iLVcnt = 0 to $nLVTotal - 1

$sLVtext = ControlListView("Customize Perspective", "", "SysListView322", "GetText", $iLVcnt, 0)

$hDisplay &= "Text from Item " & $iLVcnt & " is " & $sLVtext & @CRLF

; Is this LV Item a StarTeam option?

If StringInStr($sLVtext, "StarTeam") Then

; Click the current LV Item...

_ListView_ClickItem($nLVCHwnd, $iLVcnt, $PRIMARY)

MsgBox(4096, "Debugging...", "Did the _ListView_ClickItem function work for LV Item " & $iLVcnt & "?")

EndIf

; Tap the Down Arrow to force the LV control to scroll along with the above edits...

Send ("{DOWN}")

Next

Return FileWrite($hDisplayFile, $hDisplay)

EndFunc

Func _Determine_Control_Info($hWnd)

If IsString($hWnd) And WinExists($hWnd) Then $hWnd = WinGetHandle($hWnd)

Local $aWGCI = _WinGetCtrlInfo($hWnd)

If IsArray($aWGCI) = 0 Then Return SetError(1, 0, '')

Local $nControlID

For $iCC = 1 To $aWGCI[0][0]

ControlFocus($hWnd, '', $aWGCI[$iCC][0])

If $aWGCI[$iCC][0] = "SysListView322" Then

$nControlID = $aWGCI[$iCC][1]

EndIf

Next

Return $nControlID

EndFunc

...and here is what the output debug file is showing...

CODE

Results of walking through the SysListView322 Controls:

----------------------

Control handle is 2163578

Number of Items is 60

----------------------

Text from Item 0 is Annotation Navigation

Text from Item 1 is Breakpoints

Text from Item 2 is Cheat Sheets

Text from Item 3 is Compiled Debug

Text from Item 4 is Connector

Text from Item 5 is Convert Web Project Type

Text from Item 6 is Data Definition

Text from Item 7 is Debug

Text from Item 8 is Editor Navigation

Text from Item 9 is Editor Presentation

Text from Item 10 is EJB

Text from Item 11 is EJB

Text from Item 12 is EJB Deployment

Text from Item 13 is eSupportClient Action Set

Text from Item 14 is External Tools

Text from Item 15 is J2EE

Text from Item 16 is Java Coding

Text from Item 17 is Java Debug

Text from Item 18 is Javadoc with Diagrams

Text from Item 19 is Java Editor Presentation

Text from Item 20 is Java Element Creation

Text from Item 21 is Java Navigation

Text from Item 22 is Java Open Actions

Text from Item 23 is Java Search

Text from Item 24 is JUnit

Text from Item 25 is Launch

Text from Item 26 is Open External Files

Text from Item 27 is Page Designer Edit

Text from Item 28 is Page Designer Form

Text from Item 29 is Page Designer Format

Text from Item 30 is Page Designer Frame

Text from Item 31 is Page Designer Insert

Text from Item 32 is Page Designer Insert JSP

Text from Item 33 is Page Designer Style

Text from Item 34 is Page Designer Table

Text from Item 35 is Page Designer Tools

Text from Item 36 is Page Designer Views

Text from Item 37 is Process

Text from Item 38 is Profile

Text from Item 39 is Proxy Tools

Text from Item 40 is Resource Navigation

Text from Item 41 is SampleGalleryActionSetLabel

Text from Item 42 is Search

Text from Item 43 is Search...

Text from Item 44 is Serena Professional

Text from Item 45 is Server

Text from Item 46 is Software Updates

Text from Item 47 is Software Updates

Text from Item 48 is SQL/DDL Script

Text from Item 49 is SQL Statement

Text from Item 50 is StarTeam

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

STARTEAM FOUND !!!

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Text from Item 51 is StarTeam Commands

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

STARTEAM FOUND !!!

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Text from Item 52 is Team

Text from Item 53 is TutorialGalleryActionSetLabel

Text from Item 54 is View Definition

Text from Item 55 is Web Advanced

Text from Item 56 is Web Basic

Text from Item 57 is Web Browser

Text from Item 58 is Web Main

Text from Item 59 is Web Project

Anyone have an idea why the _ListView_ClickItem() is not working? The output file shows that I am passing a valid ControlID to the function, highlighted above.

:whistle:

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Ok, I have gotten past all of the above issues with the SysListView control. Not perfect solutions, since I couldn't get some functins to work, but I was still able to make a workable script.

I have now moved on to the next panel, which contains a SysTreeView control. At this point, I am simply trying to extract the text from the top level of each node. So far, I get nothing back. Nor can I get a useful count of the number of nodes in the control (whether maximum -allowed value or number-visible value). Here's what I have cobbled together so far:

CODE

Func Preferences()

WinMenuSelectItem("J2EE - IBM Rational Software Development Platform", "", "&Window", "&Preferences" )

; Raise the "Preferences" panel...

WinWait("Preferences", "")

WinActivate("Preferences", "")

; Define a few useful variables...

Local $hWnd = "Preferences"

Local $aWGCI = _WinGetCtrlInfo($hWnd)

Local $sClassNameNNN

Local $nControlID

If $BoolDb Then MsgBox(4096, "Debugging...", "Total number of nodes in the SysTreeView control = " & $aWGCI[0][0])

For $iCC = 1 To $aWGCI[0][0]

ControlFocus($hWnd, '', $aWGCI[$iCC][0])

If StringInStr($aWGCI[$iCC][0], "SysTreeView") Then

$sClassNameNNN = $aWGCI[$iCC][0]

$nControlID = $aWGCI[$iCC][1]

If $BoolDb Then MsgBox(4096, "Debugging...", "$sClassNameNNN = " & $sClassNameNNN & ", $nControlID = " & $nControlID)

ExitLoop

EndIf

Next

$nNodeCnt = _TreeView_GetVisibleCount($nControlID)

; We need to process the lone SysTreeView control...

For $iNC = 1 to $nNodeCnt

; Try to pull the label directly from the SysTreeView control...

$TreeVar = _TreeView_GetText($nControlID, $iNC)

If $BoolDb Then MsgBox(4096, "Debugging...", "Preference label for Node #" & $iNC & " is " & $TreeVar)

;If $TreeVar = "Team" Then Send("{RIGHT}")

;Send("{DOWN}")

Next

EndFunc

In the above code, I can never get anything to populate the $TreeVar variable. And the $aWGCI[0][0] value contains "43" -- not the 22 unexpanded nodes I physically see on the screen, nor the 100+ subnodes and sub-subnodes I get when manually expanding them all. I have no idea where the "43" is coming from.

Any ideas how to tally the number of top-level nodes in a SysTreeView control, how to walk through them, and how to extract the text from each node? :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...