Sign in to follow this  
Followers 0
Mike  :)

GUICreate in Function

2 posts in this topic

Well, I just fixed all the Send('{SPACE}') stuff :lmao:. I was so happy, I felt like I was closing to the far end of my script and then.... wat da f**k!!

:P My another problem is about GUICreate command used in function called by button. I really don't know why it doesn't work, well.... here's the code:

$button4 = GUICtrlCreateButton ("", 290, 0, 170, 115, $BS_BITMAP + $BS_FLAT)
GUICtrlSetImage (-1, "pic\pic.bmp")
GUISetOnEvent ($button4, "Pop")
Global $advanced = 0

Here's the button code calling function Pop. Well, here goes the function

Func Pop()
    Global $advanced = 1
GUICreate("Y", 215, 297, @DesktopWidth/2, @DesktopHeight/2,$WS_POPUP + $WS_EX_CLIENTEDGE )
    Guisetstate()
$def1 = GuiCtrlCreateCheckbox("", 60, 40, 10, 10)
$Group_4 = GuiCtrlCreateGroup("", 90, 30, 30, 260)
$Group_5 = GuiCtrlCreateGroup("", 130, 30, 30, 260)
$def2 = GuiCtrlCreateCheckbox("", 60, 70, 10, 10)
$def3 = GuiCtrlCreateCheckbox("", 60, 100, 10, 10)
$def4 = GuiCtrlCreateCheckbox("", 60, 130, 10, 10)
$def5 = GuiCtrlCreateCheckbox("", 60, 160, 10, 10)
$att1 = GuiCtrlCreateCheckbox("", 100, 40, 10, 10)
$att2 = GuiCtrlCreateCheckbox("", 100, 70, 10, 10)
$att3 = GuiCtrlCreateCheckbox("", 100, 100, 10, 10)
$att4 = GuiCtrlCreateCheckbox("", 100, 130, 10, 10)
$att5 = GuiCtrlCreateCheckbox("", 100, 160, 10, 10)
$heal1 = GuiCtrlCreateCheckbox("", 140, 40, 10, 10)
$heal2 = GuiCtrlCreateCheckbox("", 140, 70, 10, 10)
$heal3 = GuiCtrlCreateCheckbox("", 140, 100, 10, 10)
$heal4 = GuiCtrlCreateCheckbox("", 140, 130, 10, 10)
$heal5 = GuiCtrlCreateCheckbox("", 140, 160, 10, 10)
$Label_20 = GuiCtrlCreateLabel("Player1", 10, 40, 40, 20)
$Label_21 = GuiCtrlCreateLabel("Player2", 10, 70, 40, 20)
$Label_22 = GuiCtrlCreateLabel("Player3", 10, 100, 40, 20)
$Label_23 = GuiCtrlCreateLabel("Player4", 10, 130, 40, 20)
$Label_24 = GuiCtrlCreateLabel("Player5", 10, 160, 40, 20)
$alldef = GuiCtrlCreateCheckbox("", 60, 270, 10, 10)
GUISetOnEvent (-1, "ALL")
$allatck = GuiCtrlCreateCheckbox("", 100, 270, 10, 10)
GUISetOnEvent (-1, "ALL")
$allheal = GuiCtrlCreateCheckbox("", 140, 270, 10, 10)
GUISetOnEvent (-1, "ALL")
$Group_28 = GuiCtrlCreateGroup("", 50, 30, 30, 260)
$Label_29 = GuiCtrlCreateLabel("Defense", 43, 10, 40, 20)
$Label_29 = GuiCtrlCreateLabel("Attack", 89, 10, 40, 20)
$Label_29 = GuiCtrlCreateLabel("Heal", 133, 10, 40, 20)
EndFunc



Func ALL()
MsgBox(1, "", GUICtrlRead($alldef))
    Global $buff = 0
    If GUICtrlRead($alldef) = 1 Then
        GUICtrlSetState($def1,$GUI_CHECKED) 
        GUICtrlSetState($def2,$GUI_CHECKED) 
        GUICtrlSetState($def3,$GUI_CHECKED) 
        GUICtrlSetState($def4,$GUI_CHECKED) 
        GUICtrlSetState($def5,$GUI_CHECKED) 
        Global $buff = 1
    ElseIf GUICtrlRead($alldef) = 0  AND $buff = 1 Then
        GUICtrlSetState($def1,$GUI_UNCHECKED) 
        GUICtrlSetState($def2,$GUI_UNCHECKED) 
        GUICtrlSetState($def3,$GUI_UNCHECKED) 
        GUICtrlSetState($def4,$GUI_UNCHECKED) 
        GUICtrlSetState($def5,$GUI_UNCHECKED) 
    Global $buff = 0
EndIf
Global $buff1 = 0
    If GUICtrlRead($allatck) = 1 Then
        GUICtrlSetState($att1,$GUI_CHECKED) 
        GUICtrlSetState($att2,$GUI_CHECKED) 
        GUICtrlSetState($att3,$GUI_CHECKED) 
        GUICtrlSetState($att4,$GUI_CHECKED) 
        GUICtrlSetState($att5,$GUI_CHECKED) 
        Global $buff1 = 1
    ElseIf GUICtrlRead($allatck) = 0  AND $buff1 = 1 Then
        GUICtrlSetState($att1,$GUI_UNCHECKED) 
        GUICtrlSetState($att2,$GUI_UNCHECKED) 
        GUICtrlSetState($att3,$GUI_UNCHECKED) 
        GUICtrlSetState($att4,$GUI_UNCHECKED) 
        GUICtrlSetState($att5,$GUI_UNCHECKED) 
    EndIf
    Global $buff2 = 0
    If GUICtrlRead($allheal) = 1 Then
        GUICtrlSetState($heal1,$GUI_CHECKED) 
        GUICtrlSetState($heal2,$GUI_CHECKED) 
        GUICtrlSetState($heal3,$GUI_CHECKED) 
        GUICtrlSetState($heal4,$GUI_CHECKED) 
        GUICtrlSetState($heal5,$GUI_CHECKED) 
        Global $buff2 = 1
    ElseIf GUICtrlRead($allheal) = 0  AND $buff2 = 1 Then
        GUICtrlSetState($heal1,$GUI_UNCHECKED) 
        GUICtrlSetState($heal2,$GUI_UNCHECKED) 
        GUICtrlSetState($heal3,$GUI_UNCHECKED) 
        GUICtrlSetState($heal4,$GUI_UNCHECKED) 
        GUICtrlSetState($heal5,$GUI_UNCHECKED) 
    EndIf
    EndFunc

Any ideas why it doesn't work?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

nvm I added new topic...

Edited by Mike :)

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