Jump to content

Flickering again !


star2
 Share

Recommended Posts

here's the GUI again

it keeps on flickering and doesn't work as I expected

yesterday I tried all night to figure it up but no use

can anyone help?

#include <guiconstants.au3>
GUICreate("test", 150, 100)
$check_1 = GUICtrlCreateCheckbox("check-1", 10, 20)
$check_2 = GUICtrlCreateCheckbox("check-2", 80, 20)
$apply = GUICtrlCreateButton("Apply", 10, 60, 130)
GUICtrlSetState(-1, $gui_disable)

$chk_1 = IniRead("test.ini", "checks", "chk_1", 4)
If $chk_1 = 1 Then
    GUICtrlSetState($check_1, $GUI_CHECKED)
ElseIf $chk_1 = 4 Then
    GUICtrlSetState($check_1, $GUI_UNCHECKED)
EndIf

$chk_2 = IniRead("test.ini", "checks", "chk_2", 4)
If $chk_2 = 1 Then
    GUICtrlSetState($check_2, $GUI_CHECKED)
ElseIf $chk_2 = 4 Then
    GUICtrlSetState($check_2, $GUI_UNCHECKED)
EndIf

GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If GUICtrlRead($check_1) <> $chk_1 Then
        If Bitand(GUICtrlGetState($apply),$gui_enable) <> $gui_enable Then GUICtrlSetState($apply, $gui_enable)
    Else
        If Bitand(GUICtrlGetState($apply),$gui_disable) <> $gui_disable Then GUICtrlSetState($apply, $gui_disable)
    EndIf
    If GUICtrlRead($check_2) <> $chk_2 Then
    If Bitand(GUICtrlGetState($apply),$gui_enable) <> $gui_enable Then GUICtrlSetState($apply, $gui_enable)
    Else
    If Bitand(GUICtrlGetState($apply),$gui_disable) <> $gui_disable Then GUICtrlSetState($apply, $gui_disable)
    EndIf
    If $msg = $apply Then
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = $GUI_CHECKED Then
            IniWrite("test.ini", "checks", "chk_1", 1)
            $chk_1 = 1
        Else
            IniWrite("test.ini", "checks", "chk_1", 4)
            $chk_1 = 4
        EndIf
        If BitAND(GUICtrlRead($check_2), $GUI_CHECKED) = $GUI_CHECKED Then
            IniWrite("test.ini", "checks", "chk_2", 1)
            $chk_2 = 1
        Else
            IniWrite("test.ini", "checks", "chk_2", 4)
            $chk_2 = 4
        EndIf
        GUICtrlSetState($apply, $gui_disable)
    EndIf
WEnd

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

  • Developers

Just some advise for you: Put some debug Consolewrite statements in your script to understand why it is flickering.

In this case its because one IF disables the Button and the next IF enables it ....and that over and over again.

To solve that issue you need to make it one If statement like:

If GUICtrlRead($check_1) <> $chk_1 Or GUICtrlRead($check_2) <> $chk_2 Then
        If BitAND(GUICtrlGetState($apply), $gui_enable) <> $gui_enable Then GUICtrlSetState($apply, $gui_enable)
    Else
        If BitAND(GUICtrlGetState($apply), $gui_disable) <> $gui_disable Then GUICtrlSetState($apply, $gui_disable)
    EndIf

:)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Just some advise for you: Put some debug Consolewrite statements in your script to understand why it is flickering.

In this case its because one IF disables the Button and the next IF enables it ....and that over and over again.

--------------

I really did that yesterday but it didn't work I understand what u said

and it's correct

when I tried it now it work !! it's drivin me crazy

mabey yesterday I was sleepy that's why

thank u so much

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

#include <guiconstants.au3>
GUICreate("test", 150, 100)
$check_1 = GUICtrlCreateCheckbox("check-1", 10, 20)
$check_2 = GUICtrlCreateCheckbox("check-2", 80, 20)
$apply = GUICtrlCreateButton("Apply", 10, 60, 130)
GUICtrlSetState(-1, $gui_disable)

$chk_1 = IniRead("test.ini", "checks", "chk_1", 4)
If $chk_1 = 1 Then
    GUICtrlSetState($check_1, $GUI_CHECKED)
ElseIf $chk_1 = 4 Then
    GUICtrlSetState($check_1, $GUI_UNCHECKED)
EndIf

$chk_2 = IniRead("test.ini", "checks", "chk_2", 4)
If $chk_2 = 1 Then
    GUICtrlSetState($check_2, $GUI_CHECKED)
ElseIf $chk_2 = 4 Then
    GUICtrlSetState($check_2, $GUI_UNCHECKED)
EndIf

GUISetState()
AdlibEnable("Control", 500)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func Control()
    If GUICtrlRead($check_1) <> $chk_1 Then
        If Bitand(GUICtrlGetState($apply),$gui_enable) <> $gui_enable Then GUICtrlSetState($apply, $gui_enable)
    Else
        If Bitand(GUICtrlGetState($apply),$gui_disable) <> $gui_disable Then GUICtrlSetState($apply, $gui_disable)
    EndIf
    If GUICtrlRead($check_2) <> $chk_2 Then
    If Bitand(GUICtrlGetState($apply),$gui_enable) <> $gui_enable Then GUICtrlSetState($apply, $gui_enable)
    Else
    If Bitand(GUICtrlGetState($apply),$gui_disable) <> $gui_disable Then GUICtrlSetState($apply, $gui_disable)
    EndIf
    If $msg = $apply Then
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = $GUI_CHECKED Then
            IniWrite("test.ini", "checks", "chk_1", 1)
            $chk_1 = 1
        Else
            IniWrite("test.ini", "checks", "chk_1", 4)
            $chk_1 = 4
        EndIf
        If BitAND(GUICtrlRead($check_2), $GUI_CHECKED) = $GUI_CHECKED Then
            IniWrite("test.ini", "checks", "chk_2", 1)
            $chk_2 = 1
        Else
            IniWrite("test.ini", "checks", "chk_2", 4)
            $chk_2 = 4
        EndIf
        GUICtrlSetState($apply, $gui_disable)
    EndIf
EndFunc

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