Jump to content

preset tasks


Deye
 Share

Recommended Posts

Hi,

I made this as an example on the way to make a function that can save specific configurations as presets that are to be  saved into a cuted magic number, so I can hard code and load a specific preset on tasks

I never needed more than just a few, so I didn't delve into getting this done
Nevertheless it will be interesting to see what function can do this where you would have 20 or more tasks

 

#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <GuiComboBox.au3>

Local $hGUI = GUICreate("Example")
Local $bTest = GUICtrlCreateButton("Set", 250, 10, 85, 25)
Local $bAdd = GUICtrlCreateButton("Add", 250, 150, 85, 25)
Local $hCombo = GUICtrlCreateCombo("", 50, 10, 185, 20)
Global $checked = ""

Local $x = 50, $y = 20

For $i = 1 To 24
    If $i = 9 or $i = 17 Then
        $x += 60
        $y = 20
    EndIf
    $y += 40
    Assign("check_" & $i, GUICtrlCreateCheckbox("Task" & $i, $x, $y, 60, 20))
Next

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $bTest
            Local $aArray = Eval(GUICtrlRead($hCombo))

            For $i = 1 To 24
                GUICtrlSetState(Eval("check_" & $i), $GUI_unchecked)
            Next
            For $i = 1 To $aArray[0]
                GUICtrlSetState(Eval("check_" & $aArray[$i]), $GUI_CHECKED)
            Next

        Case $bAdd
            $checked = ""
            For $i = 1 To 24
                If _IsChecked(Eval("check_" & $i)) Then
                    $checked &= $i & ","
                EndIf
            Next
            Local $a = StringSplit($checked, ",")
            Local $count = _GUICtrlComboBox_GetCount($hCombo)
            GUICtrlSetData($hCombo, "preset_" & $count)
            _GUICtrlComboBox_SetCurSel($hCombo, $count)
            Assign("preset_" & $count, $a)
;~          MouseWheelFocus($hGUI,"",$hCombo)
    EndSwitch
WEnd

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

Thanks 

Deye

Edited by Deye
Link to comment
Share on other sites

FrancescoDiMuro,

probably  :)

About magic numbering the tasks:
like the grey in the day, I can't think of any example right now on how it can be useful ..
maybe where there will be in function BitOR (adding) mostly BitAND (returning) 
And that's about it.

who knows, Maybe this can help trigger idea's for someone 

Deye

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...