Jump to content
Sign in to follow this  
Glenac

GUICtrlSetOnEvent and array

Recommended Posts

Glenac

Hey everyone,

I am wondering how can I set a GuiCtrlSetOnEvent on a GUICtlr stored in an array.

What I want to do is creating 4 checkboxes with 2 subparams for each, and when a checkbox is checked, it unlocks subparams in the _getStates function.

Here is my code:

Dim $array[4][3]


For $i = 0 To 3

$array[$i][0] = GUICtrlCreateCheckbox("Param" & $i + 1, $bLeft, $bTop)

GUICtrlCreateLabel("SubParam2: ", $bLeft + 10, $bTop + 25, 100, 15)
$array[$i][0] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetState($array[$i][0], $GUI_DISABLE)

GUICtrlCreateLabel("SubParam2 : ", $bLeft + 10, $bTop + 50, 100, 15)
$array[$i][1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15)
GUICtrlSetState($array[$i][1], $GUI_DISABLE)

; HERE IS THE PROBLEM...
GUICtrlSetOnEvent($array[$i][0], "_getStates")

Next

The problem is GUICtrlSetOnEvent( $array[$i][0] , "_getStates") does not work. It looks like my $array[0][0] does not return the correct ID.

If I do a msg box on it, I get an int like 23.

Is there any solution for this?

Thanks in advance for the help.

Best regards

Edited by Glenac

Share this post


Link to post
Share on other sites
BrewManNH

Why are you using a 2D array for this? A 1D array would work much better.

Dim $array[3]


$array[0] = GUICtrlCreateCheckbox("Param" & $i + 1, $bLeft, $bTop)
GUICtrlSetOnEvent(-1, "your_function")
GUICtrlCreateLabel("SubParam2: ", $bLeft + 10, $bTop + 25, 100, 15)
$array[1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetOnEvent(-1, "your_function")
GUICtrlSetState($array[$i][0], $GUI_DISABLE)

GUICtrlCreateLabel("SubParam2 : ", $bLeft + 10, $bTop + 50, 100, 15)
$array[2] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15)
GUICtrlSetOnEvent(-1, "your_function")
GUICtrlSetState($array[$i][1], $GUI_DISABLE)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Glenac

Why are you using a 2D array for this? A 1D array would work much better.

Dim $array[3]


$array[0] = GUICtrlCreateCheckbox("Param" & $i + 1, $bLeft, $bTop)
GUICtrlSetOnEvent(-1, "your_function")
GUICtrlCreateLabel("SubParam2: ", $bLeft + 10, $bTop + 25, 100, 15)
$array[1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetOnEvent(-1, "your_function")
GUICtrlSetState($array[$i][0], $GUI_DISABLE)

GUICtrlCreateLabel("SubParam2 : ", $bLeft + 10, $bTop + 50, 100, 15)
$array[2] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15)
GUICtrlSetOnEvent(-1, "your_function")
GUICtrlSetState($array[$i][1], $GUI_DISABLE)

Hi BrewMan,

Thank you for your answer I'll try this within a minute.

I was using 2D array because subparams are directly linked to the checkbox. When you

I thought it would be easier for me to haves something like this which I would be able to access later because I know exactly what are corresponding the array key with.

$array[0][0] ; => CheckBox state (checked / unchecked)
$array[0][1] ; => SubParam 1
$array[0][2] ; => SubParam 2

The SetOnEvent must be binded only to the checkbox only, not on the subparams. But Im a PHP developer, that may explain why I have been thinking this way.

Glen

Share this post


Link to post
Share on other sites
Glenac

Alright,

Found the solution:

Dim $array[4][3]


For $i = 0 To 3

$array[$i][0] = GUICtrlCreateCheckbox("Param" & $i + 1, $bLeft, $bTop)
GUICtrlSetOnEvent(-1, "_getStates") ; This is how it worked, using -1 directly after the declaration instead of $array[$i][0]

GUICtrlCreateLabel("SubParam2: ", $bLeft + 10, $bTop + 25, 100, 15)
$array[$i][0] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetState($array[$i][0], $GUI_DISABLE)

GUICtrlCreateLabel("SubParam2 : ", $bLeft + 10, $bTop + 50, 100, 15)
$array[$i][1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15)
GUICtrlSetState($array[$i][1], $GUI_DISABLE)

Next

Thanks anyway ;)

Regards,

Glenac

Edited by Glenac

Share this post


Link to post
Share on other sites
nitekram

I am not sure your example will work - or will work the way you have planned. Yet I am not really sure what you have planned? But in your code you are going to overwrite the first paramater with the second? Maybe you posted wrong code?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
BrewManNH

Hi BrewMan,

Thank you for your answer I'll try this within a minute.

I was using 2D array because subparams are directly linked to the checkbox. When you

What are you trying to say here because I'm not getting where you're going?

Perhaps if you posted a working script I could take a look at it to see what exactly you're trying to do, because your snippet isn't going to work at all like you're hoping it will.

I thought it would be easier for me to haves something like this which I would be able to access later because I know exactly what are corresponding the array key with.

The SetOnEvent must be binded only to the checkbox only, not on the subparams. But Im a PHP developer, that may explain why I have been thinking this way.

Glen

As nitekram said, you're overwriting the first array element further down in the loop, so you're losing whatever it held before. What is a subparam, and what does the checkbox have to do with it? The code I posted, while incomplete will assign the control ids, returned by the control creation functions, to an array element, and also sets the onevent function to that control. Although, if you're using OnEvent you don't really need the control ID unless you're going to be accessing them some other way, in which case, you probably don't want an onevent function tied to them.

In any case, without knowing what it is you're doing in the script, it's practically impossible to know how to tell what you'd need for the controls.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
nitekram

Does this work?

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Dim $array[4][3]
Local $bLeft = 5
Local $bTop = 5

GUICreate("My GUI", 400, 400) ; will create a dialog box that when displayed is centered
GUISetOnEvent($GUI_EVENT_CLOSE, "_getStates")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_getStates")
GUISetOnEvent($GUI_EVENT_RESTORE, "_getStates")

For $i = 0 To 3

    $array[$i][0] = GUICtrlCreateCheckbox("Param" & $i + 1, $bLeft, $bTop)

    GUICtrlCreateLabel("SubParam2: ", $bLeft + 75, $bTop)
    $array[$i][1] = GUICtrlCreateInput("", $bLeft + 150, $bTop)
    ;GUICtrlSetState($array[$i][0], $GUI_DISABLE)

    GUICtrlCreateLabel("SubParam3 : ", $bLeft + 225, $bTop)
    $array[$i][2] = GUICtrlCreateInput("", $bLeft + 300, $bTop)
    ;GUICtrlSetState($array[$i][1], $GUI_DISABLE)

    ;$bLeft += 5
    $bTop += 25

    ; HERE IS THE PROBLEM...
    GUICtrlSetOnEvent($array[$i][0], "_getStates")

Next
GUISetState(@SW_SHOW) ; will display an empty dialog box

While 1
    Sleep(20)
WEnd


Func _getStates()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            Exit

        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

        Case Else
            ;MsgBox('', '@GUI_CtrlId', @GUI_CtrlId)
            For $x = 0 To 3
                If @GUI_CtrlId = $array[$x][0] Then
                    MsgBox('', 'CheckBox ' & $x + 1, 'Param2 = ' & GUICtrlRead($array[$x][1]) & ' ' & 'Param3 = ' & GUICtrlRead($array[$x][2]))
                EndIf
            Next

    EndSelect
EndFunc   ;==>_getStates

EDIT changed the code to search all check boxes in a loop

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
Glenac

Hey guys,

thanks for your time. Yes there was an error with my arrays.

Here is the correct version which is working:

Dim $array[4][3]
; $array[0][0] => active state (checked or not)
; $array[0][1] => Key
; $array[0][2] => Delay

For $i = 0 To UBound($buff)-1

$array[$i][0] = GUICtrlCreateCheckbox("Action " & $i + 1, $bLeft, $bTop)
GUICtrlSetOnEvent(-1, "_activebuff")
GUICtrlCreateLabel("Key : ", $bLeft + 10, $bTop + 25, 100, 15)
$array[$i][1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetState($buff[$i][1], $GUI_DISABLE)

GUICtrlCreateLabel("Delay (in ms) : ", $bLeft + 10, $bTop + 50, 100, 15)
$array[$i][2] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15)
GUICtrlSetState($buff[$i][2], $GUI_DISABLE)

Next

Here is the result:

Posted Image

All fields "Key" and "Delay" are disabled until user check the "Action" box corresponding.

I wanted it to be dynamic just in case I need to add more actions.

Thanks again.

Share this post


Link to post
Share on other sites
nitekram

I am not sure if you have fixed your issue or not, but one thing would help - if you would give us a workable code to work with. You keep giving us a bit of your code, but your code is not working as posted. And though, you may have other code that makes it work - we do not see that. Your posted code has two different arrays, which looks like there is code that is missing. Create a workable code and post it - working and stand alone, and maybe someone can see what you are talking about.

But this, besides the format, does what I think you were/are trying to do???

Edit - changed format

Edit 2 - Fixed code to match what OP wanted - added

If GUICtrlRead($array[$x][0]) = $GUI_CHECKED Then
                        GUICtrlSetState($array[$x][1], $GUI_ENABLE)
                        GUICtrlSetState($array[$x][2], $GUI_ENABLE)
                    Else
                        GUICtrlSetState($array[$x][1], $GUI_DISABLE)
                        GUICtrlSetState($array[$x][2], $GUI_DISABLE)
                    EndIf

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Dim $array[4][3]
Local $bLeft = 5
Local $bTop = 5

GUICreate("My GUI", 425, 200) ; will create a dialog box that when displayed is centered
GUISetOnEvent($GUI_EVENT_CLOSE, "_getStates")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_getStates")
GUISetOnEvent($GUI_EVENT_RESTORE, "_getStates")



For $i = 0 To 3
    ;$i = 0
    $array[$i][0] = GUICtrlCreateCheckbox("Action" & $i + 1, $bLeft, $bTop)

    GUICtrlCreateLabel("Key:", $bLeft + 10, $bTop + 25)
    $array[$i][1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 100)
    GUICtrlSetState($array[$i][1], $GUI_DISABLE)
    ;#cs
    GUICtrlCreateLabel("Delay (in ms):", $bLeft + 10, $bTop + 50)
    $array[$i][2] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 100)
    GUICtrlSetState($array[$i][2], $GUI_DISABLE)
    ;#ce


    Switch $i
        Case 0 ; 2
            $bLeft = 230
            $bTop = 0
        Case 1 ; 3
            $bLeft = 5
            $bTop = 105
        Case 2 ; 4
            $bLeft = 230
            $bTop = 105
    EndSwitch

    ; HERE IS THE PROBLEM...
    GUICtrlSetOnEvent($array[$i][0], "_getStates")

Next
GUISetState(@SW_SHOW) ; will display an empty dialog box

While 1
    Sleep(20)
WEnd


Func _getStates()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            ;MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            Exit

        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            ;MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            ;MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

        Case Else
            ;MsgBox('', '@GUI_CtrlId', @GUI_CtrlId)
            For $x = 0 To 3
                If @GUI_CtrlId = $array[$x][0] Then

                    ;MsgBox('', 'CheckBox ' & $x + 1, 'Param2 = ' & GUICtrlRead($array[$x][1]) & ' ' & 'Param3 = ' & GUICtrlRead($array[$x][2]))
                    If GUICtrlRead($array[$x][0]) = $GUI_CHECKED Then
                        GUICtrlSetState($array[$x][1], $GUI_ENABLE)
                        GUICtrlSetState($array[$x][2], $GUI_ENABLE)
                    Else
                        GUICtrlSetState($array[$x][1], $GUI_DISABLE)
                        GUICtrlSetState($array[$x][2], $GUI_DISABLE)
                    EndIf

                EndIf
            Next

    EndSelect
EndFunc   ;==>_getStates
Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
Glenac

Hi,

Sorry, for the errors and the wrong copy/paste. Lack of sleep these last few days...

Here is a working code:

#include

Opt("GUIOnEventMode", 1)

Global $guiWidth = 500
Global $guiHeght = 500

Global $buff[4][3]

GUICreate("", $guiWidth, $guiHeght)
GUICtrlCreateLabel("", $guiWidth * 28 / 100, 8, $guiWidth, 17)

GUICtrlCreateTab(2, 25, $guiWidth - 4, $guiHeght - 27)
GUICtrlCreateTabItem("Buffs")
ESBTab()
GUICtrlCreateTabItem("")
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")

While 1
Sleep(100)
WEnd

Func ESBTab()
Local $left = 30
Local $top = 60
Local $ESBLeft = $left + 15
Local $ESBLeft2 = $ESBLeft + 110
Local $ESBTop = $top + 25

GUICtrlCreateGroup("Buffs :", $left, $ESBTop, $guiWidth - 60, 250)
For $i = 0 To UBound($buff, 1) - 1
Local $bTop = $ESBTop
Local $bLeft = $left + 30
Switch $i
Case 0
$bTop += 35
Case 1
$bTop += 35
$bLeft += 225
Case 2
$bTop += 120
Case 3
$bTop += 120
$bLeft += 225
EndSwitch

$buff[$i][0] = GUICtrlCreateCheckbox("Buff " & $i + 1, $bLeft, $bTop)
GUICtrlSetOnEvent($buff[$i][0], "_activebuff")
GUICtrlCreateLabel("Key : ", $bLeft + 10, $bTop + 25, 50, 15)
$buff[$i][1] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetState($buff[$i][1], $GUI_DISABLE)

GUICtrlCreateLabel("Delay (in ms) : ", $bLeft + 10, $bTop + 50, 65, 15)
$buff[$i][2] = GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15, 0x2000)
GUICtrlSetState($buff[$i][2], $GUI_DISABLE)
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)

EndFunc ;==>ESBTab

Func _activebuff()
For $i = 0 To UBound($buff, 1)-1
If GUICtrlRead($buff[$i][0]) == $GUI_CHECKED Then
GUICtrlSetState($buff[$i][1], $GUI_ENABLE)
GUICtrlSetState($buff[$i][2], $GUI_ENABLE)
Else
GUICtrlSetState($buff[$i][1], $GUI_DISABLE)
GUICtrlSetState($buff[$i][2], $GUI_DISABLE)
EndIf
Next
EndFunc ;==>_activebuff

Func _Terminate()
Exit
EndFunc ;==>_Terminate

It works like this.

Best regards

Glenac

Share this post


Link to post
Share on other sites
PhoenixXL

Some mathematical calculation can do better job without the need of the Variables

Check the example for understanding

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Global $guiWidth = 500
Global $guiHeght = 500

GUICreate("", $guiWidth, $guiHeght)
GUICtrlCreateLabel("", $guiWidth * 28 / 100, 8, $guiWidth, 17)

GUICtrlCreateTab(2, 25, $guiWidth - 4, $guiHeght - 27)
GUICtrlCreateTabItem("Buffs")
ESBTab()
GUICtrlCreateTabItem("")
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")

While 1
Sleep(100)
WEnd

Func ESBTab()
Local $left = 30, $bTop
Local $top = 60, $bLeft
Local $ESBLeft = $left + 15
Local $ESBLeft2 = $ESBLeft + 110
Local $ESBTop = $top + 25

GUICtrlCreateGroup("Buffs :", $left, $ESBTop, $guiWidth - 60, 250)
For $i = 0 To 3
$bTop = $ESBTop
$bLeft = $left + 30
Switch $i
Case 0
$bTop += 35
Case 1
$bTop += 35
$bLeft += 225
Case 2
$bTop += 120
Case 3
$bTop += 120
$bLeft += 225
EndSwitch

GUICtrlCreateCheckbox("Buff " & $i + 1, $bLeft, $bTop)
GUICtrlSetOnEvent(-1, "_activebuff")
GUICtrlCreateLabel("Key : ", $bLeft + 10, $bTop + 25, 50, 15)
GUICtrlCreateInput("", $bLeft + 80, $bTop + 25, 50, 15)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateLabel("Delay (in ms) : ", $bLeft + 10, $bTop + 50, 65, 15)
GUICtrlCreateInput("", $bLeft + 80, $bTop + 50, 50, 15, 0x2000)
GUICtrlSetState(-1, $GUI_DISABLE)
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)

EndFunc ;==>ESBTab

Func _activebuff()
If GUICtrlRead(@GUI_CtrlId) == $GUI_CHECKED Then
GUICtrlSetState(@GUI_CtrlId + 2, $GUI_ENABLE)
GUICtrlSetState(@GUI_CtrlId + 4, $GUI_ENABLE)
Else
GUICtrlSetState(@GUI_CtrlId + 2, $GUI_DISABLE)
GUICtrlSetState(@GUI_CtrlId + 4, $GUI_DISABLE)
EndIf
EndFunc ;==>_activebuff

Func _Terminate()
Exit
EndFunc ;==>_Terminate
Thumbs up if it helped :) Edited by PhoenixXL
  • Like 1

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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  

×