Jump to content

Grey


Recommended Posts

Is it possible to have a checkbox that enables and disables this input box? Like you see on most apps, the input boxes are greyed out until you tick the box that says "I want to do this"

dim $mailto

$sendto = GuiCtrlCreateInput($mailto, 200, 200, 170, 20)

Link to comment
Share on other sites

Try GUictrlsetstate() function.

GUictrlsetstate($MyInput,$GUI_DISABLE)
Yeh that looks cool, any idea why it doesnt work the other way? when you untick should go grey again

while 1

$msg = GUIGetMsg()

If $msg = BitOR($reporton, $GUI_CHECKED) Then

GUictrlsetstate($mailto,$GUI_ENABLE)

GUictrlsetstate($msrv,$GUI_ENABLE)

GUictrlsetstate($muser,$GUI_ENABLE)

EndIf

If $msg = BitOR($reporton, $GUI_UNCHECKED) Then

GUictrlsetstate($mailto,$GUI_DISABLE)

GUictrlsetstate($msrv,$GUI_DISABLE)

GUictrlsetstate($muser,$GUI_DISABLE)

EndIf

wend

Link to comment
Share on other sites

while 1
$msg = GUIGetMsg()
If BitAND($reporton, $GUI_CHECKED) Then
GUictrlsetstate($mailto,$GUI_ENABLE)
GUictrlsetstate($msrv,$GUI_ENABLE)
GUictrlsetstate($muser,$GUI_ENABLE)
EndIf

If BitAND($reporton, $GUI_UNCHECKED) Then
GUictrlsetstate($mailto,$GUI_DISABLE)
GUictrlsetstate($msrv,$GUI_DISABLE)
GUictrlsetstate($muser,$GUI_DISABLE)
EndIf
wend

[size=20]My File Upload[/size]Register at my site and upload.

Link to comment
Share on other sites

that doesnt seem to work either and just makes the gui refresh like mad!

here is what I want to do

#include <GUIConstants.au3>

;#NoTrayIcon

GUICreate("Q-Backup" & " version " & $v & " Setup and Installation Wizard",640,480)

$reporton = GUICtrlCreateCheckBox ("e-Mail report when finished", 170, 170)

$sendastext = GUICtrlCreateCheckBox ("Send e-Mail as plain text (not recommended)", 186, 180)

$mailto = GuiCtrlCreateInput("e-Mail address for reports", 200, 200, 170, 20)

$msrv = GuiCtrlCreateInput("Mail server name", 200, 240, 170, 20)

$muser = GuiCtrlCreateInput("Mailbox Username", 200, 260, 170, 20)

$smtpauth = GUICtrlCreateCheckBox ("My SMTP server requires authentication", 300, 290)

$smtpu = GuiCtrlCreateInput("Username", 200, 320, 170, 20)

$smtpp = GuiCtrlCreateInput("Password", 200, 340, 170, 20)

$helpbutton = GuiCtrlCreateButton ("Help!",414,435,70,20)

$quitbutton = GuiCtrlCreateButton ("Quit",489,435,70,20)

$nextbutton = GuiCtrlCreateButton ("Next >>",564,435,70,20)

GUictrlsetstate($mailto,$GUI_DISABLE)

GUictrlsetstate($msrv,$GUI_DISABLE)

GUictrlsetstate($muser,$GUI_DISABLE)

GUictrlsetstate($smtpp,$GUI_DISABLE)

GUictrlsetstate($smtpu,$GUI_DISABLE)

GuiSetState()

While 1

$msg = GUIGetMsg()

If $msg = BitOR($sendastext, $GUI_CHECKED) Then Msgbox(262208,"Plain text reports", "Qual-IT do not recommend setting this option as plain text reports can be huge! Please clear this option to allow Q-Backup to send the report as a ZIP file unless you have good reason to want the report in plain text.")

If $msg = BitAnd($reporton, $GUI_CHECKED) Then

GUictrlsetstate($mailto,$GUI_ENABLE)

GUictrlsetstate($msrv,$GUI_ENABLE)

GUictrlsetstate($muser,$GUI_ENABLE)

EndIf

If $msg = BitAnd($reporton, $GUI_UNCHECKED) Then

GUictrlsetstate($mailto,$GUI_DISABLE)

GUictrlsetstate($msrv,$GUI_DISABLE)

GUictrlsetstate($muser,$GUI_DISABLE)

EndIf

If $msg = BitAnd($smtpauth, $GUI_CHECKED) Then

GUictrlsetstate($smtpu,$GUI_ENABLE)

GUictrlsetstate($smtpp,$GUI_ENABLE)

EndIf

Select

Wend

Link to comment
Share on other sites

Take a look at this example.

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Example", 268, 72, 192, 125)
$Input1 = GUICtrlCreateInput("AInput1", 8, 8, 249, 21, -1, $WS_EX_CLIENTEDGE)
$Checkbox1 = GUICtrlCreateCheckbox("ACheckbox1", 16, 40, 73, 17)
GUISetState(@SW_SHOW)
While 1
    if GUIctrlread($Checkbox1) = $GUI_CHECKED Then
        GUIctrlsetstate($Input1,$GUI_DISABLE)
        Elseif GUIctrlread($Checkbox1) = $GUI_UNCHECKED Then
        GUictrlsetstate($Input1,$GUI_ENABLE)
    EndIf
    
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

It keeps flickering because its in the while/wend loop, maybe add a sleep()?

[size=20]My File Upload[/size]Register at my site and upload.

Link to comment
Share on other sites

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Example", 268, 72, 192, 125)
$Input1 = GUICtrlCreateInput("AInput1", 8, 8, 249, 21, -1, $WS_EX_CLIENTEDGE)
$Checkbox1 = GUICtrlCreateCheckbox("ACheckbox1", 16, 40, 73, 17)
GUISetState(@SW_SHOW)
While 1
    
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Checkbox1
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($Input1, $GUI_DISABLE)
            Else
                GUICtrlSetState($Input1, $GUI_ENABLE)
            EndIf
    EndSelect
WEnd
Exit

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Weird, I still don't understand the whole BitAND/OR stuff.

I always used this code. 1 = checked 4 = unchecked

$Selected = GUICtrlRead($Checkbox);Read the current state of the checkbox
If $Selected = 1 Then
;Do something cause it's checked
ElseIf $Selected = 4 Then
;Do something cause it's unchecked
Else
;;;
EndIf

Mike

Link to comment
Share on other sites

Weird, I still don't understand the whole BitAND/OR stuff.

I always used this code. 1 = checked 4 = unchecked

$Selected = GUICtrlRead($Checkbox);Read the current state of the checkbox
If $Selected = 1 Then
;Do something cause it's checked
ElseIf $Selected = 4 Then
;Do something cause it's unchecked
Else
;;;
EndIf

Mike

In this case both work the same, but

Here's from the help file in the GuiCtrlRead section

For Checkbox, Radio control several states can be returned as $GUI_FOCUS and $GUI_CHECKED,. So use BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the control is checked.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...