Sign in to follow this  
Followers 0
solid2005

Tabsheet

4 posts in this topic

CODE
#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#include <GUIConstants.au3>

#include <File.au3>

#include <Constants.au3>

#include <GuiListView.au3>

#include <GuiComboBox.au3>

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

Local $Form1_1, $Buttonclicked, $Checkbox_F1, $nMsg

$Form1_1 = GUICreate("My Collection", 1024, 768)

$Buttonclicked = GUICtrlCreateButton ("OK", 5, 730, 75, 23)

GUICtrlSetOnEvent(-1,"Buttonclicked")

GUICtrlCreateTab(0, 8, 1024, 700)

WinSetState($Form1_1, "", @SW_MAXIMIZE)

GUICtrlCreateTabItem("F")

GUICtrlCreatePic("C:\PSP\Image\Final Fantasy.JPG", 9, 38, 200, 100)

$Checkbox_F1 = GUICtrlCreateCheckbox("Final Fantasy - 20th Anniversary", 224, 88, 200, 17)

GUICtrlSetOnEvent(-1,"Final_Fantasy")

GUICtrlSetFont(-1, 8, 400, 0, "Arial")

GUISetState()

Func Buttonclicked()

If BitAND(GUICtrlRead($Checkbox_F1), $GUI_CHECKED) = $GUI_CHECKED Then Final_Fantasy()

MsgBox(0,"Info","OK Finish")

EndFunc

Func Final_Fantasy()

If BitAND(GUICtrlRead($Checkbox_F1),$GUI_CHECKED)=$GUI_CHECKED Then

MsgBox(0,"Info","All: is now checked")

Else

MsgBox(0,"Info","All: is now unchecked")

EndIf

EndFunc

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

:)

Msg could not be work.

my be i over loaded the #include? or i miss some thing?

Share this post


Link to post
Share on other sites



Opt('GuiOnEventMode', 1)

But you can't to mix two GUI mode: the GUI MessageLoop Mode and the GUI OnEvent Mode

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You're mixing OnEvent mode with Msg polling.

OnEvent mode only:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <File.au3>
#include <Constants.au3>
#include <GuiListView.au3>
#include <GuiComboBox.au3>
#include <GuiMenu.au3>
Opt('MustDeclareVars', 1)
Opt("GuiOnEventMode",1); >>>>>>>> Added to activate OnEvent mode
Local $Form1_1, $Buttonclicked, $Checkbox_F1, $nMsg

$Form1_1 = GUICreate("My Collection", 1024, 768)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit"); >>>>>>>> Added call to _Exit Function if Gui Closed

$Buttonclicked = GUICtrlCreateButton ("OK", 5, 730, 75, 23)
GUICtrlSetOnEvent(-1,"Buttonclicked")
GUICtrlCreateTab(0, 8, 1024, 700)
WinSetState($Form1_1, "", @SW_MAXIMIZE)
GUICtrlCreateTabItem("F")
GUICtrlCreatePic("C:\PSP\Image\Final Fantasy.JPG", 9, 38, 200, 100)
$Checkbox_F1 = GUICtrlCreateCheckbox("Final Fantasy - 20th Anniversary", 224, 88, 200, 17)
GUICtrlSetOnEvent(-1,"Final_Fantasy")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUISetState()


Func Buttonclicked()
If BitAND(GUICtrlRead($Checkbox_F1), $GUI_CHECKED) = $GUI_CHECKED Then Final_Fantasy()
MsgBox(0,"Info","OK Finish")
_Exit(); >>>>>>>> Added call to Exit function
EndFunc

Func Final_Fantasy()
If BitAND(GUICtrlRead($Checkbox_F1),$GUI_CHECKED)=$GUI_CHECKED Then
MsgBox(0,"Info","All: is now checked")
Else
MsgBox(0,"Info","All: is now unchecked")
EndIf
EndFunc

While 1
#CS; >>>>>>>> Don't need to poll for GuiMsg in OnEvent mode
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
#CE
Sleep(10); >>>>>>>> Added a little sleep in the loop
WEnd


Func _Exit(); >>>>>>>> Added _Exit Function if Gui Closed
    Exit
EndFunc
Edited by ResNullius

Share this post


Link to post
Share on other sites

Thanks You

Share this post


Link to post
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
Sign in to follow this  
Followers 0