Sign in to follow this  
Followers 0
skippynz

has something happened to $gui_checked ?

10 posts in this topic

in a recent upgrade did the $gui_checked get removed ? i ask cause i have

$state = GUICtrlGetState ( $Backup_Folder1d )

if $state = $GUI_CHECKED then
    whateva......
endif

in one of my scripts and it appears to have stopped working

what can i use to replace it - cause if i check what $state = with the checkbox checked or not they both come out as '80'

cheers

craig

Share this post


Link to post
Share on other sites



If $state is a checkbox/radio then that statement would never have worked... Actually it wouldn't have done anything either way. You need to use GuiCtrlRead()


If I post a code or snippet, please tell me what I did wrong and/or what I can do better. Tell me my code/idea sucks, if it does. If I ask for help, refrain from only telling me to search the help file and/or the forums. I will search before asking, I just may not have searched with good keywords. If I say that I will look into something or fix something later, understand that I am most likely lying.

Share this post


Link to post
Share on other sites

Errrmm, are you checking if a checkbox is checked? Look up GUICtrlCreateCheckbox, and $state = GUICtrlCreateCheckbox(....)

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i will explain further - this use to work until recently.

this is part of a backup script ive created using autoit if the user press the button it will prompt for a folder to choose then create a checkbox for that button - then ensure its ticked.

Case $msg1 = $Backup_Folder7
$Backup_Folder7a = FileSelectFolder("Please choose the folder that needs to be backed up.","",2,"C:\")
if not @error Then
$Backup_Folder7b = StringSplit($Backup_Folder7a,"\",1)
$x = $Backup_Folder7b[0]
$Backup_Folder7c = $Backup_Folder7b[$x]
GUICtrlSetData ( $Backup_Folder7, $Backup_Folder7c )
if $Backup_Folder7a <> "" Then
$Backup_Folder7d = GUICtrlCreateCheckbox ( "", 495, $c7,15,15)
GUICtrlSetState ( $Backup_Folder7d, $GUI_CHECKED )
EndIf
EndIf
oÝ÷ ÚØ^ºÇ««-¢Þ²ÆÚrK©¶(ا¹æî¶,׶!yÉ-«m쬶)eÁ©íyÛhm§$ºaj×è׫趲r§ëaêæwZÛ§rØ^~]z¼víÁ©í¶ÚrH­º^Ǧʷ²ß¢»¬x-è.Ëk­²Ö­y«­¢+Ø(ÀÌØíÍÑÑÜôU%
ÑɱÑMÑÑ ÀÌØí  ­ÕÁ}½±Èݤ)¥ÀÌØí    ­ÕÁ}½±ÈݱÐìÐìÅÕ½ÐìÅÕ½Ðì¹ÀÌØíÍÑÑÜôÀÌØíU%}
!
-Q¡¸)U%
ÑɱMÑÑ ÀÌØíÑáаÌäí  ­¥¹ÕÀÑ¡ÅÕ½ÐìÌäìµÀìÀÌØí    ­ÕÁ}½±ÈݵÀìÌäìÅÕ½Ðì½±ÈÌäì¤)AɽÉÍÍ
½Áä ÀÌØí ­ÕÁ}½±ÈÝ°MÉ¥ÁѥȵÀìÌäìÀäÈìÌäìµÀìUÍÉ9µµÀìÌäìÀäÈí=Ñ¡ÈÀäÈí½±ÈÜÌäì°Ä¤)%¹¥]ɥѡMÉ¥ÁѥȵÀìÌäìÀäÈìÌäìµÀìUÍÉ9µµÀìÌäìÀäÈí=Ñ¡ÈÀäÈí½±É̹¥¹¤Ìäì°ÅÕ½Ðí½±ÈÜÅÕ½Ðì°ÅÕ½Ðí9µÅÕ½Ðì°ÀÌØí ­ÕÁ}½±Èݤ)¥MÑÉ¥¹%¹MÑÈ ÀÌØí  ­ÕÁ}½±ÈűUÍÉAɽ¥±¥È¤Q¡¸(ÀÌØí½±ÈÝôMÑÉ¥¹IÁ± ÀÌØí    ­ÕÁ}½±ÈÝ°UÍÉAɽ¥±¥È°ÅÕ½ÐíÕÍÉÁɽ¥±ÅÕ½Ðì°Ä¤)±Í(ÀÌØí½±ÈÝôÀÌØí ­ÕÁ}½±ÈÝ)¹%)¥MÑÉ¥¹%¹MÑÈ ÀÌØí½±ÈÝ°ÅÕ½ÐíèÀäÈìÅÕ½Ðì¤Q¡¸(ÀÌØí½±ÈÝôMÑÉ¥¹IÁ± ÀÌØí½±ÈÝ°ÅÕ½ÐíèÀäÈìÅÕ½Ðì°ÅÕ½ÐíèÀäÈìÅÕ½Ðì°Ä¤)±Í(ÀÌØí½±ÈÅôÀÌØí½±ÈÝ)¹%)%¹¥]ɥѡMÉ¥ÁѥȵÀìÌäìÀäÈìÌäìµÀìUÍÉ9µµÀìÌäìÀäÈí=Ñ¡ÈÀäÈí½±É̹¥¹¤Ìäì°ÅÕ½Ðí½±ÈÜÅÕ½Ðì°ÅÕ½Ðí1½Ñ¥½¸ÅÕ½Ðì°ÀÌØí½±Èݤ)¹%(

like i say it use to work till recently.

Edited by craig.gill

Share this post


Link to post
Share on other sites

Look up GUICtrlCreateCheckbox, and $state = GUICtrlCreateCheckbox(....)

Ehm, what ? Are you trying to say that GUICtrlCreateCheckbox returns the state and not the controlID ?

How would that work ? Would $state be automagically updated whenever the checkbox' state was changed ?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

original:

$state7 = GUICtrlGetState ( $Backup_Folder7d )
if $Backup_Folder7a <> "" and $state7 = $GUI_CHECKED Then ...
oÝ÷ Úw°jëh×6If $Backup_Folder7a <> "" and IsChecked($Backup_Folder7d) Then ...

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc
Edited by Zedna

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ehm, what ? Are you trying to say that GUICtrlCreateCheckbox returns the state and not the controlID ?

How would that work ? Would $state be automagically updated whenever the checkbox' state was changed ?

Okay jeez Helge, all I was trying to do was help, I was in a rush since I had to go. If you want me to write an example for him, than I will. Was just trying to point him in the right direction.

#include <GUIconstants.au3>
Guicreate("test")
$checkbox = Guictrlcreatecheckbox("CLICK ME", 10, 10)
$label = GUICtrlCreateLabel("", 10, 40, 300)
GuiSetState()

While 1
    If Guictrlread($checkbox) = $GUI_CHECKED Then GUICtrlSetData($label, "Checkbox = checked")
    ;Checks if checkbox = checked
    If Guictrlread($checkbox) = $GUI_UNCHECKED Then GUICtrlSetData($label, "Checkbox = unchecked")
    ;Checks if checkbox = unchecked
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

There ya go,

Kurt

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

original:

$state7 = GUICtrlGetState ( $Backup_Folder7d )
if $Backup_Folder7a <> "" and $state7 = $GUI_CHECKED Then ...
oÝ÷ Úw°jëh×6If $Backup_Folder7a <> "" and IsChecked($Backup_Folder7d) Then ...

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc
thanks for this - its done the trick but just strange that the $gui_checked stopped working out of the blue

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Okay jeez Helge, all I was trying to do was help, I was in a rush since I had to go.

What are you jeezing me for ? You wrote $state = GUICtrlCreateCheckbox(....), so what am I to think ?

It's kind of hard for me to know what you intend with whatever you write, so when you write it like that....

Seriously, what do you expect us to make out of it ? I followed my logic and how you wrote it like that

there's no way I could in any way figure out that you meant to throw in a GUICtrlRead, and because of

that I said what I said : $state would hold the controlId, and that's the truth.

EDIT : And just so that you know it...I was trying to help as well, by telling Craig that it wouldn't work.

Edited by Helge

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