Sign in to follow this  
Followers 0
KillingEye

Problem with checkbox

12 posts in this topic

Hi,

Need help with Checkboxes:

Description:

When a checkbox get "checked" a InputBox opens. <- work

When a checkbox get unchecked it should NOT open a Inputbox, but when i unheck the checkbox the damn Inputbox opens

My Code:

$Herooff = GuiCtrlCreateCheckbox("Hero", 30, 240, 130);checkbox

Case $msg = $Herooff
                $InputHerooff = InputBox("Hero", "Hero?")
                Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)

It is not the whole Code... only a little part.

Share this post


Link to post
Share on other sites



the Case statement *imprettysure* only means if it is Checked\Unchecked (both) so maybe try

if $msg = $Herooff then

$InputHerooff = InputBox("Hero", "Hero?")

Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)

endif

OR

if $herooff = '4' then ;meaning if it is OFF;

$InputHerooff = InputBox("Hero", "Hero?")

Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)

endif

OR

if $herooff = '1' then ;meaning if it is ON;

$InputHerooff = InputBox("Hero", "Hero?")

Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)

endif

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Is the "OR" Part of the Code?

Edited by KillingEye

Share this post


Link to post
Share on other sites

sorry bout that, no it is not P:

Share this post


Link to post
Share on other sites

@bob00037

KillingEye would understand if you put codes for scripts :

if $msg = $Herooff then
$InputHerooff = InputBox("Hero", "Hero?")
Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)
endif

OR

if $herooff = '4' then;meaning if it is OFF;
$InputHerooff = InputBox("Hero", "Hero?")
Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)
endif

OR

if $herooff = '1' then;meaning if it is ON;
$InputHerooff = InputBox("Hero", "Hero?")
Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)
endif

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

yeha thats what i ment lol, i should sstart using code brakets more... andyway you cloud try those NOT THE 'OR' lol and if neither work then idk

Share this post


Link to post
Share on other sites

thank you for this help...

but it does not work... now there appears no Inputbox o_O

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

$msg will = $herooff when it is checked or unchecked (because in a GUI you might want it to show elements when checked, and hide elements when unchecked

$hereoff is always going to be constant, as it's the controlID. So checking it against other values won't do anything

GUICtrlRead($Herooff) will tell you if it's checked or not.

It will equal 1 if checked, 0 if unchecked.

Case $msg = $Herooff AND GUICtrlRead($Herooff)=1
                $InputHerooff = InputBox("Hero", "Hero?")
                Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)
Edited by TurionAltec

Share this post


Link to post
Share on other sites

It Works :D:D:D

Thank you!!! :)

bob00037: Thank you also for your help :o

Share this post


Link to post
Share on other sites

lol no problem

ps i thought unchecked = 4 and checked =1 thats what my msgbox(0,'',guictrlread()) says

Share this post


Link to post
Share on other sites

lol no problem

ps i thought unchecked = 4 and checked =1 thats what my msgbox(0,'',guictrlread()) says

You're right!

I shouldn't have been so sloppy. Plus it could be reporting if it has focus, so we should do a BitAnd.

If we include <GUIConstantsEx.au3>:

$GUI_UNCHECKED=4

$GUI_CHECKED =1

So we could code it in as:

Case $msg = $Herooff AND BitAnd(GUICtrlRead($Herooff),$GUI_CHECKED)=$GUI_CHECKED
                $InputHerooff = InputBox("Hero", "Hero?")
                Iniwrite("off.ini", "Truppen", "Hero", $InputHerooff)

Share this post


Link to post
Share on other sites

looks good to me :)

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