关于循环暂停的问题,望高手解答!!!
请高手帮忙看看要如何才能实现下面代码中提示的内容。#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$Form1 = GUICreate("窗体1", 336, 304, -1, -1)
$Group1 = GUICtrlCreateGroup("资料查询", 3, 0, 330, 60)
$Combo1 = GUICtrlCreateCombo("种类", 12, 24, 57, 25)
GUICtrlSetData(-1, "种类1|种类2|种类3|种类4|种类5")
GUICtrlSetFont(-1, 10, 400, 0, "宋体")
$Combo2 = GUICtrlCreateCombo("名称", 84, 24, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "宋体")
$Combo3 = GUICtrlCreateCombo("规格", 155, 24, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "宋体")
$Button1 = GUICtrlCreateButton("开始查询", 228, 22, 81, 25, $BS_DEFPUSHBUTTON)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView1 = GUICtrlCreateListView("种类|名称|规格|数量|价格", 3, 68, 330, 233, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT))
GUICtrlSendMsg(-1, 0x101E, 0, 65)
GUICtrlSendMsg(-1, 0x101E, 1, 65)
GUICtrlSendMsg(-1, 0x101E, 2, 65)
GUICtrlSendMsg(-1, 0x101E, 3, 65)
GUICtrlSendMsg(-1, 0x101E, 4, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$Sort = GUICtrlRead($Combo1)
$Name = GUICtrlRead($Combo2)
$Spec = GUICtrlRead($Combo3)
If $Sort = "种类" Or $Name = "名称" Or $Spec = "规格" Then
If BitAND(GUICtrlGetState($Button1), $GUI_Enable) Then GUICtrlSetState($Button1, $GUI_DISABLE)
Else
If BitAND(GUICtrlGetState($Button1), $GUI_DISABLE) Then GUICtrlSetState($Button1, $GUI_Enable)
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Combo3
If $Sort = "种类1" Then
GUICtrlSetData($Combo2, "名称1|名称2|名称3|名称4|名称5")
EndIf ;==>Question1.这里能否只循环运行一次,即下拉列表中只出现一次 "名称1|名称2|名称3|名称4|名称5"
If $Sort = "种类2" Then
GUICtrlSetData($Combo2, "名称A|名称B|名称C|名称D|名称E")
EndIf ;==>Question2.这里如果第一次选择"种类1"再选择"种类2"显示$Combo2里显示的还是"名称1|名称2|名称3|名称4|名称5"
If $Name = "名称1" Then
GUICtrlSetData($Combo3, "规格1|规格2|规格3|规格4|规格5")
EndIf ;==>同Question1.
If $Name = "名称A" Then
GUICtrlSetData($Combo3, "规格A|规格B|规格C|规格D|规格E")
EndIf ;==>同Question2.
Case $Button1
If $Sort = "种类1" And $Name = "名称1" And $Spec = "规格1" Then
$ListView1_0 = GUICtrlCreateListViewItem("种类1|名称1|规格1|N|$", $ListView1)
EndIf
EndSwitch
WEnd
[ 本帖最后由 frozen 于 2008-7-20 01:00 编辑 ] 用事件模式or用treeview 能否举例说明一下?帮帮忙吧!:face (36): treeview:face (13): 这个是啥? $Combo1 = GUICtrlCreateCombo("种类", 12, 24, 57, 25)
GUICtrlSetOnEvent($Combo1, "OKCombo");;;为指定控件的点击行为定义一个用户函数 谢谢楼上的,但我想知道的是具体应该如何定义函数。
大家有没有这方面的例子可以供我参考一下。 谢谢大家帮忙,自己解决了。 把代码贴出来供有需要的朋友参考。#include
#include
#include
#include
#include
#include
#Region ### START Koda GUI section ###
$Form1 = GUICreate("窗体1", 336, 304, -1, -1)
$Group1 = GUICtrlCreateGroup("资料查询", 3, 0, 330, 60)
$Combo1 = GUICtrlCreateCombo("种类", 12, 24, 57, 25)
GUICtrlSetData(-1, "种类1|种类2|种类3|种类4|种类5")
GUICtrlSetFont(-1, 10, 400, 0, "宋体")
$Combo2 = GUICtrlCreateCombo("名称", 84, 24, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "宋体")
$Combo3 = GUICtrlCreateCombo("规格", 155, 24, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "宋体")
$Button1 = GUICtrlCreateButton("开始查询", 228, 22, 81, 25, $BS_DEFPUSHBUTTON)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView1 = GUICtrlCreateListView("种类|名称|规格|数量|价格", 3, 68, 330, 233, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSendMsg(-1, 0x101E, 0, 65)
GUICtrlSendMsg(-1, 0x101E, 1, 65)
GUICtrlSendMsg(-1, 0x101E, 2, 65)
GUICtrlSendMsg(-1, 0x101E, 3, 65)
GUICtrlSendMsg(-1, 0x101E, 4, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$Sort = GUICtrlRead($Combo1)
$Name = GUICtrlRead($Combo2)
$Spec = GUICtrlRead($Combo3)
If $Sort = "种类" Or $Name = "名称" Or $Spec = "规格" Then
If BitAND(GUICtrlGetState($Button1), $GUI_Enable) Then GUICtrlSetState($Button1, $GUI_DISABLE)
Else
If BitAND(GUICtrlGetState($Button1), $GUI_DISABLE) Then GUICtrlSetState($Button1, $GUI_Enable)
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Combo1
Name()
Case $Combo2
Spec()
Case $Button1
If $Sort = "种类1" And $Name = "名称1" And $Spec = "规格1" Then
$ListView1_0 = GUICtrlCreateListViewItem("种类1|名称1|规格1|N|$", $ListView1)
EndIf
EndSwitch
WEnd
Func Name()
GUICtrlSetData($Combo2, "")
If $Sort = "种类" Then
GUICtrlSetData($Combo2, "名称")
ElseIf $Sort = "种类1" Then
GUICtrlSetData($Combo2, "名称1|名称2|名称3|名称4|名称5")
ElseIf $Sort = "种类2" Then
GUICtrlSetData($Combo2, "名称A|名称B|名称C|名称D|名称E")
EndIf
EndFunc ;==>Name
Func Spec()
GUICtrlSetData($Combo3, "")
If $Sort = "种类" And $Name = "名称" Then
GUICtrlSetData($Combo3, "规格")
ElseIf $Sort = "种类1" And $Name = "名称1" Then
GUICtrlSetData($Combo3, "规格1|规格2|规格3|规格4|规格5")
ElseIf $Sort = "种类2" And $Name = "名称A" Then
GUICtrlSetData($Combo3, "规格A|规格B|规格C|规格D|规格E")
EndIf
EndFunc 共同学习一下了
页:
[1]