Jump to content

reading out checkboxes


Guest nap
 Share

Recommended Posts

You meen the Funktion like this?

#include <GUIConstants.au3>

Global $CommanderCheck, $CommanderRead

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 0)

Opt("TrayIconHide", 1)

$mainwindow = GuiCreate("Zen - ScriptBox - neZ", 400, 350)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

$helpmenu = GUICtrlCreateMenu ("?")

$optionitem = GUICtrlCreateMenuitem ("Optionen",$helpmenu)
GUICtrlSetOnEvent($optionitem, "Optionen")

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
Wend


Func Optionen()
    
    $CommanderCheck = GUICtrlCreateCheckbox("Commander?", 10, 10, 120, 20)
    GUICtrlSetOnEvent($CommanderCheck, "CommanderCheck")
    GUISetState()

EndFunc

Func CommanderCheck()
    If $CommanderCheck = $GUI_CHECKED Then
        $Commander = "20"
        IniWrite("Optionen.ini" , "Optionen", "Commander", $Commander)
    Else
        $Commander = "0"
        IniWrite("Optionen.ini" , "Optionen", "Commander", $Commander)
    EndIf
EndFunc

Func Terminate()
  If @GUI_WINHANDLE = $mainwindow Then 
    MsgBox(0, "Bye Bye", "Thanks for you visiting :) ", 5)
    Exit
  EndIf 
EndFunc

Func Terminate()
  If @GUI_WINHANDLE = $mainwindow Then 
    MsgBox(0, "Bye Bye", "Thanks for you visiting :) ", 5)
    Exit
  EndIf 
EndFunc

It doesn't work too. Where is the mistake now?

Link to comment
Share on other sites

You meen the Funktion like this?

#include <GUIConstants.au3>

Global $CommanderCheck, $CommanderRead

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 0)

Opt("TrayIconHide", 1)

$mainwindow = GuiCreate("Zen - ScriptBox - neZ", 400, 350)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

$helpmenu = GUICtrlCreateMenu ("?")

$optionitem = GUICtrlCreateMenuitem ("Optionen",$helpmenu)
GUICtrlSetOnEvent($optionitem, "Optionen")

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
Wend
Func Optionen()
    
    $CommanderCheck = GUICtrlCreateCheckbox("Commander?", 10, 10, 120, 20)
    GUICtrlSetOnEvent($CommanderCheck, "CommanderCheck")
    GUISetState()

EndFunc

Func CommanderCheck()
    If $CommanderCheck = $GUI_CHECKED Then
        $Commander = "20"
        IniWrite("Optionen.ini" , "Optionen", "Commander", $Commander)
    Else
        $Commander = "0"
        IniWrite("Optionen.ini" , "Optionen", "Commander", $Commander)
    EndIf
EndFunc

Func Terminate()
  If @GUI_WINHANDLE = $mainwindow Then 
    MsgBox(0, "Bye Bye", "Thanks for you visiting :) ", 5)
    Exit
  EndIf 
EndFunc

Func Terminate()
  If @GUI_WINHANDLE = $mainwindow Then 
    MsgBox(0, "Bye Bye", "Thanks for you visiting :) ", 5)
    Exit
  EndIf 
EndFunc

It doesn't work too. Where is the mistake now?

<{POST_SNAPBACK}>

you setup the GuiCtrlSetOnEvent() correctly, this time your issue is in your function. look at the value $ControlCommander is assigned, and then look at your condition statement. this time, since you obviously thought about it a little, i'll give you a little more direct help.

use the help file to find out the possible return values of this line

$CommanderCheck = GUICtrlCreateCheckbox("Commander?", 10, 10, 120, 20)

meaning what value will be stored in $CommanderCheck. Also you may want to double check how to read the value stored in a control. Remember you have one value stored in your variable, and a different that can be read from the control... Read the entire help file piece on the function in the line quoted above. It'll straighten you out pretty quick, and you'll feel better for having figured this part out yourself.
Link to comment
Share on other sites

:dance:

I feel me angry, because i dont know why this shit didn't run.

If i found my problem in the help-file, i wouldn't be here!

..:: EDIT ::..

I have it...

#include <GUIConstants.au3>

Global $CommanderCheck

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 0)

Opt("TrayIconHide", 1)

$mainwindow = GuiCreate("Zen - ScriptBox - neZ", 400, 350)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

$helpmenu = GUICtrlCreateMenu ("?")

$optionitem = GUICtrlCreateMenuitem ("Optionen",$helpmenu)
GUICtrlSetOnEvent($optionitem, "Optionen")

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
Wend


Func Optionen()
    GUISetState()
    $CommanderCheck = GUICtrlCreateCheckbox("Commander?", 10, 10)
    GUICtrlSetOnEvent($CommanderCheck, "CommanderCheck")
    $CommanderRead = IniRead("Optionen.ini", "Optionen", "Commander", "Not Found")
    If $CommanderRead = "20" Then GUICtrlSetState($CommanderCheck, $GUI_CHECKED)

EndFunc


Func CommanderCheck()
    $Commander = GUICtrlRead($CommanderCheck)
    If $Commander = $GUI_CHECKED Then
        IniWrite("Optionen.ini", "Optionen", "Commander", "20")
    Else
        IniWrite("Optionen.ini", "Optionen", "Commander", "0")
    EndIf
EndFunc


Func Terminate()
  If @GUI_WINHANDLE = $mainwindow Then 
    MsgBox(0, "Bye Bye", "Thanks for you visiting :) ", 5)
    Exit
  EndIf 
EndFunc

:whistle:

Thank you for the help :dance:

Edited by Zen
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...