copy正常呀.
#include<array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("简单的Combo三级联动 by:绿色风 简易工作室 http://www.jianyiit.com", 868, 177, 192, 132)
$Combo1 = GUICtrlCreateCombo("Combo1", 8, 136, 161, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Combo2 = GUICtrlCreateCombo("Combo2", 192, 136, 177, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Combo3 = GUICtrlCreateCombo("Combo3", 400, 136, 185, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Input1 = GUICtrlCreateInput("我爱绿色风,大家绿色风", 616, 136, 217, 24)
$Label1 = GUICtrlCreateLabel("省 级", 56, 104, 99, 20)
$Label2 = GUICtrlCreateLabel("市 级", 240, 104, 99, 20)
$Label3 = GUICtrlCreateLabel("县/区 级", 448, 104, 99, 20)
$Label4 = GUICtrlCreateLabel("对应天气网的ID编号", 634, 104, 150, 20)
$Button1 = GUICtrlCreateButton(">>刷下存在,简单的三级联动<<", 88, 8, 635, 57)
GUICtrlSetFont(-1, 19, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $ini = "天气数据.dat"
_Cob0() ;省级目录
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Combo1 ;一级
_Cob1()
Case $Combo2 ;二级
_cob2()
Case $Combo3 ;三级
_cob3() ;联动到天气ID
Case $Button1
ShellExecute("iexplore.exe", "www.jianyiit.com")
EndSwitch
WEnd
Func _Cob0() ;最省一级目录
Local $arr = IniReadSection($ini, "省级")
Local $str = ""
For $i = 1 To $arr[0][0]
$str = $str & "|" & $arr[$i][0]
Next
GUICtrlSetData($Combo1, $str, $arr[1][0])
_Cob1();联动下一级
EndFunc ;==>_Cob0
Func _Cob1();取二级
Local $str = GUICtrlRead($Combo1)
Local $str2 = IniRead($ini, "省级", $str, "")
Local $arr = StringSplit($str2, "|")
GUICtrlSetData($Combo2, "")
GUICtrlSetData($Combo2, $str2, $arr[1])
_cob2();联动下一级
EndFunc ;==>_Cob1
Func _cob2()
Local $str = GUICtrlRead($Combo2) ;取地区
Local $arr = IniReadSection($ini, $str)
$str = ""
For $i = 1 To $arr[0][0]
$str = $str & "|" & $arr[$i][0]
Next
GUICtrlSetData($Combo3, $str, $arr[1][0]) ;设置地区到 COB3
_cob3();联动下一级
EndFunc ;==>_cob2
Func _cob3()
Local $str0 = GUICtrlRead($Combo2);市级
Local $str1 = GUICtrlRead($Combo3) ;区县级
Local $str2 = IniRead($ini, $str0, $str1, "")
GUICtrlSetData($input1, $str2)
EndFunc ;==>_cob3
|