我已经找到方法了,谢谢楼主给我post这个问题,也谢谢各位的发言。这次我把我总结的方法贴上来,供大家参考。BTW:写成了Func.SelectListViewItem("", ,"") ;param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item Name
Func SelectListViewItem($WinName,$ControlID,$ItemName)
$ItemCount = ControlListView($WinName,"",$ControlID,"GetItemCount")
For $i = 1 to $ItemCount Step 1 ;use Loop to find given Item Name
$ItemText = ControlListView($WinName,"",$ControlID,"GetText",$i-1)
if StringCompare($ItemName,$ItemText)=0 then
ControlListView ($WinName, "", $ControlID, "SelectClear") ;Clears the selection of all items.
ControlListView ($WinName, "", $ControlID, "Select",$i-1) ;Selects given item.
Return
EndIf
Next
EndFunc
;---------------------------------------------------------------------------------------------------------------------------
SelectTreeItem("New",25280,"SN8 2800 Series Project") ;param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item Name
Func SelectTreeViewItem($WinName,$ControlID,$ItemName)
ControlTreeView ( $WinName, "",$ControlID, "Uncheck") ;Unchecks an item (if the item selected).
ControlTreeView ( $WinName, "",$ControlID, "Select" ,$ItemName) ;Selects given item.
EndFunc
;---------------------------------------------------------------------------------------------------------------------------
;param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item Name BTW: ListBox can be use too
SelectComboBoxtem("Project Setting",7065,"Level 2")
Func SelectComboBoxtem($WinName,$ControlID,$ItemName)
ControlCommand ( $WinName, "",$ControlID, "SelectString" , $ItemName)
EndFunc
|