Sign in to follow this  
Followers 0
ken82m

GUI Input Mystery

6 posts in this topic

#1 ·  Posted (edited)

I have two radiobuttons and an input associated with each one.

Each radiobutton enables its input and disables the other input.

Problem

1) Check "Archive Files"

2) Check "Limit Archive To:"

3) Check the first button for "Megabytes"

4) Enter a number into the input

5) Check the second button for "Days"

6) Notice the Megabytes entry changes back to "0"

7) Now click the button for "Megabytes" again

Problem

8) Click on the input, it changes back to teh value you entered in step 4

If you reverse that process I don't have that problem with the second input retains it's value of 0 when I click on it.

I managed to clean up my code enough to show you what's happening.

Thanks,

Kenny

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
Opt("GUICloseOnESC", 0)
Opt("TrayIconHide", 1)
Global $INIFile = @ScriptDir & "\MyMovies.ini"

Global $ArchiveGUI = GUICreate("My Movies Backup Scheduler Utility - Cleanup Settings", 634, 557)
Global $ArchiveLimitInput = GUICtrlCreateInput("0", 56, 418, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlSetState(-1, $GUI_DISABLE)
Global $KeepDaysInput = GUICtrlCreateInput("0", 98, 170, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $Label1a = GUICtrlCreateLabel(" days", 154, 173, 29, 17)
Global $Label1 = GUICtrlCreateLabel("Keep files for:", 26, 173, 68, 17)
Global $DeleteFiles = GUICtrlCreateRadio("Delete Files", 36, 248, 81, 17)
Global $ArchiveFiles = GUICtrlCreateRadio("Archive Files", 36, 272, 81, 17)
Global $Label2 = GUICtrlCreateLabel("When files expire:", 26, 228, 88, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $ArchiveLimitCheckbox = GUICtrlCreateCheckbox("Limit archive to:", 25, 391, 97, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $MBLimitCB = GUICtrlCreateRadio("", 36, 421, 17, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $DayLimitCB = GUICtrlCreateRadio("", 36, 449, 17, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $Label3a = GUICtrlCreateLabel(" megabytes", 108, 421, 58, 17)
Global $MBLimitInput = GUICtrlCreateInput("0", 56, 418, 49, 21, $ES_NUMBER)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $Label3 = GUICtrlCreateLabel(" days", 108, 449, 29, 17)
Global $DayLimitInput = GUICtrlCreateInput("0", 56, 446, 49, 21, $ES_NUMBER)
GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState(@SW_SHOW, $ArchiveGUI)

While 1
$nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ArchiveFiles
            ToggleArchive(1)
        Case $DeleteFiles
                ToggleArchive(0)
        Case $ArchiveLimitCheckbox
            If GUICtrlRead($ArchiveLimitCheckbox) = $GUI_UNCHECKED Then
            ;GUICtrlSetState($ArchiveLimitInput, $GUI_DISABLE)
                GUICtrlSetState($MBLimitCB, $GUI_DISABLE)
                GUICtrlSetState($DayLimitCB, $GUI_DISABLE)
                GUICtrlSetState($MBLimitInput, $GUI_DISABLE)
                GUICtrlSetState($MBLimitInput, $GUI_DISABLE)
            Else
                GUICtrlSetState($ArchiveLimitInput, $GUI_ENABLE)
                GUICtrlSetState($MBLimitCB, $GUI_ENABLE)
                GUICtrlSetState($DayLimitCB, $GUI_ENABLE)
            EndIf
        Case $MBLimitCB
            GUICtrlSetState($DayLimitInput, $GUI_DISABLE)
            GUICtrlSetState($MBLimitInput, $GUI_ENABLE)
            GUICtrlSetData($DayLimitInput, "0")
        Case $DayLimitCB
            GUICtrlSetState($MBLimitInput, $GUI_DISABLE)
            GUICtrlSetState($DayLimitInput, $GUI_ENABLE)
            GUICtrlSetData($MBLimitInput, "0")
    EndSwitch
WEnd


Func ToggleArchive($sStatus)
    If $sStatus = 0 Then
        $sStatus = $GUI_DISABLE
        GUICtrlSetState($DayLimitCB, $GUI_DISABLE)
        GUICtrlSetState($MBLimitCB, $GUI_DISABLE)
        GUICtrlSetState($DayLimitCB, $GUI_UNCHECKED)
        GUICtrlSetState($MBLimitCB, $GUI_UNCHECKED)
        GUICtrlSetData($MBLimitInput, "0")
        GUICtrlSetData($DayLimitInput, "0")
        GUICtrlSetState($DayLimitInput, $GUI_DISABLE)
        GUICtrlSetState($MBLimitInput, $GUI_DISABLE)
        GUICtrlSetState($ArchiveLimitCheckbox, $GUI_UNCHECKED)
        GUICtrlSetState($ArchiveLimitCheckbox, $GUI_DISABLE)
    Else
        GUICtrlSetState($ArchiveLimitCheckbox, $GUI_ENABLE)
    EndIf
EndFunc
Edited by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have two checkboxes and an input associated with each one.

Each checkbox enables its input and disables the other input.

Problem

1) Enter a number into $I1

2) I check $R2, $I2 is enabled, I1 is disabled and set to "0"

3) I click "R1", $I1 is enabled, I2 is disabled and set to "0"

4) When I actually click on the now activated I1 the value changes from "0" back to the value I previously entered.

If you reverse that process I2 retains it's value of 0 when I click on it.

Here's a sample I made of the GUI, which unfortunately works fine, I can't reproduce it in another script

But the script is extrememly large and contains multiple GUI's which is why I didn't post the whole thing.

In my script I have the exact same cases shown below, and I have reviewed every single GUICtrlCreateInput command in the script.

What other command or action could cause this?

Thanks,

Kenny

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Create GUI
Global $ArchiveGUI = GUICreate("My Movies Backup Scheduler Utility - Cleanup Settings", 634, 557)
;Create Controls
Global $MBLimitInput = GUICtrlCreateInput("0", 56, 418, 49, 21, $ES_NUMBER)
Global $DayLimitInput = GUICtrlCreateInput("0", 56, 446, 49, 21, $ES_NUMBER)

Global $ArchiveGUI = GUICreate("My Movies Backup Scheduler Utility - Cleanup Settings", 634, 557)
Global $R1 = GUICtrlCreateRadio("R1", 56, 48, 33, 33)
Global $R2 = GUICtrlCreateRadio("R2", 56, 96, 41, 41)
Global $I1 = GUICtrlCreateInput("I1", 176, 56, 65, 21)
Global $I2 = GUICtrlCreateInput("I2", 184, 104, 65, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $R1
            GUICtrlSetState($I2, $GUI_DISABLE)
            GUICtrlSetState($I1, $GUI_ENABLE)
            GUICtrlSetData($I2, "0")
        Case $R2
            GUICtrlSetState($I1, $GUI_DISABLE)
            GUICtrlSetState($I2, $GUI_ENABLE)
            GUICtrlSetData($I1, "0")
    EndSwitch
WEnd
Hi,try this, $r1 is for radio 1

While 1
If GuiCtrlGetState($r1)=$GUI_CHECKED then
GuiCtrlSetState($i1,$GUI_ENABLED)
GuiCtrlSetState($i2,$GUI_DISABLED)
Else
GuiCtrlSetState($i2,$GUI_ENABLED)
GuiCtrlSetState($i1,$GUI_DISABLED)
Endif
Wend
Edited by 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

#3 ·  Posted (edited)

Added code to reproduce problem.

It's probably something simple and stupid and just needs a fresh pair of eyes.

Thanks,

Kenny

Edited by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

You should always try to provide the smallest amount of code that will still reproduce the problem.

Share this post


Link to post
Share on other sites

sorry, got it down to bare essentials now :)


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

Well I got it I just redid Case $ArchiveLimitCheckbox from scratch

Though there was nothing in it that would change the value of the input boxes, and why would that case effect anything when I'm working with different controls....

Oh well

Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

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