3131806 发表于 2010-11-18 17:18:36

求助:不知道怎么描叙,也在论坛搜索了,应该算是窗体切换的问题?

如图:

GROUP1,GROUP2,页面1,页面2,页面3,这些都是在一个FORM里,
如何实现点击页面1,跟页面2这样的按钮,实现在Group里显示不同的内容,内容里有按钮,有LISTVIEW,等等东西
查了些资料,思路是GUISTARTGROUP,但是在点击不同按钮的时候好像实现不了隐藏上一个页面里的控件!

chenronting 发表于 2010-11-18 17:30:55

调整指定控件的状态.


GUICtrlSetState ( 控件ID, 状态 )

afan 发表于 2010-11-18 18:00:02

GUIStartGroup() 一般只用于单选框编组

yhxhappy 发表于 2010-11-18 18:07:10

楼主可以用数组来存放控件,类似这样的格式:
array=控件ID
array=GROUP1
……
array=控件ID
array=GROUP2

假如点 界面1 按钮时,就循环判断,array=GROUP1 的就显示,反之则隐藏
控件很多的时候,我都是这么干的,如果少的话用 GUICtrlSetState 就行了

3131806 发表于 2010-11-18 22:51:36

嘿嘿,能发一个例子出来看看吗?

yhxhappy 发表于 2010-11-19 09:55:14

我昨晚明明发了帖子了,今天看没看到,如果大家看到重复的,请见谅了

下面代码是做多个子窗口,在各个子窗口间切换,希望对楼主有帮助,临时做的,将就着看吧#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 625, 443, -1, -1)
$Button1 = GUICtrlCreateButton("窗口1", 528, 40, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("窗口2", 528, 88, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("窗口3", 528, 136, 75, 25, $WS_GROUP)

$Form2 = GUICreate("Choices Dialog", 345, 252, 30, 30, $WS_CHILD,"", $Form1)
$bListBox1 = GUICtrlCreateList("", 8, 8, 137, 201)
GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5")
$bButton1 = GUICtrlCreateButton(">", 156, 15, 30, 25, $WS_GROUP)
$bButton2 = GUICtrlCreateButton(">>", 156, 48, 31, 25, $WS_GROUP)
$bButton3 = GUICtrlCreateButton("<", 157, 81, 31, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_DISABLE)
$bButton4 = GUICtrlCreateButton("<<", 157, 114, 32, 25, $WS_GROUP)
$bListBox2 = GUICtrlCreateList("", 200, 8, 137, 201)
$bButton5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25, $WS_GROUP)
$bButton6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25, $WS_GROUP)
$bButton7 = GUICtrlCreateButton("&Help", 264, 225, 75, 25, $WS_GROUP)

$Form3 = GUICreate("Tabbed Notebook Dialog", 420, 320, 30, 30, $WS_CHILD,"", $Form1)
$cPageControl1 = GUICtrlCreateTab(8, 8, 396, 256)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$cTabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$cTabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$cTabSheet3 = GUICtrlCreateTabItem("TabSheet3")
GUICtrlCreateTabItem("")
$cButton1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25, $WS_GROUP)
$cButton2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25, $WS_GROUP)
$cButton3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25, $WS_GROUP)

$Form4 = GUICreate("About", 340, 253, 30, 30, $WS_CHILD,"", $Form1)
$dGroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
$dLabel1 = GUICtrlCreateLabel("Product Name", 152, 24, 72, 17, $WS_GROUP)
$dLabel2 = GUICtrlCreateLabel("Version", 152, 48, 39, 17, $WS_GROUP)
$dLabel4 = GUICtrlCreateLabel("Comments", 16, 160, 53, 17, $WS_GROUP)
$dLabel3 = GUICtrlCreateLabel("Copyright", 16, 136, 48, 17, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$dButton1 = GUICtrlCreateButton("&OK", 112, 208, 75, 25)

Local $Current = ""

GUISetState(@SW_SHOW, $Form1)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form2)
                        $Current = $Form2
                Case $Button2
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form3)
                        $Current = $Form3                       
                Case $Button3
                        If $Current <> "" Then GUISetState(@SW_HIDE, $Current)
                        GUISetState(@SW_SHOW, $Form4)
                        $Current = $Form4                       
        EndSwitch
WEnd

3131806 发表于 2010-11-19 13:04:04

多谢yhxhappy 兄,嘿嘿,应该有帮助,我试试看怎么实现我的效果,先学习一下你的代码,多谢啦!

vipanjintian 发表于 2011-3-10 10:48:22

回复 6# yhxhappy


    您老的作品太好了

yjje220222 发表于 2012-11-13 12:58:05

收藏学习!

431852 发表于 2016-9-27 09:44:13

回复 6# yhxhappy


    和我的一样,我bug,会触发alt的连击

xzh531 发表于 2016-9-29 15:34:56

和我的一样,我bug,会触发alt的连击
页: [1]
查看完整版本: 求助:不知道怎么描叙,也在论坛搜索了,应该算是窗体切换的问题?