Sign in to follow this  
Followers 0
star2

enable / disable button

7 posts in this topic

this is the GUI

#include <GUIConstants.au3>

GUICreate("test", 400, 200)
GUISetFont(12)
GUICtrlCreateLabel("please select your picture", 8, 4)
$put1 = GUICtrlCreateInput("", 8, 25, 200, 25)
$open = GUICtrlCreateButton("select picture", 214, 25, 150, 25)
GUICtrlCreateLabel("enter your name please", 8, 60)
$put2 = GUICtrlCreateInput("", 8, 80, 200, 25)

$save = GUICtrlCreateButton("Save", 44, 150, 200, 25)
GUICtrlSetState ($save,$GUI_DISABLE)
GUISetState()
GUICtrlSetFont ($put1, 9)

While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
            if $msg = $open Then
                $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)")
                If Not @error Then GUICtrlSetData($put1,$sFile)
                EndIf
            Select
                Case     GUICtrlRead($put1) And GUICtrlSetData($img,$sFile)
                         GUICtrlSetState ($sav,$GUI_ENABLE)
            EndSelect
WEnd

all what I want it to do is to enable the save button but after these conditions:

1- user must have selected an image file using the select picture button.

2- some text must be entered in the input control.

if both conditions are ok then enable the save button

what's wrong with my script?


[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]

Share this post


Link to post
Share on other sites



Well at the moment the only way I can see this happening is through a custom GUI, or maybe a dll. Have a search through the forums for File Save Advanced. Might turn something up :shocked:

Share this post


Link to post
Share on other sites

Just a few typos is all.

While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
            if $msg = $open Then
                $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)")
                If Not @error Then GUICtrlSetData($put1,$sFile)
                EndIf
            Select
;                Case GUICtrlRead($put1) And GUICtrlSetData($img,$sFile) ;;; the control called $img has not been defined in your example!
            Case GUICtrlRead($put1) And GUICtrlRead($put2)
;           GUICtrlSetState ($sav,$GUI_ENABLE) ; Typo!! $save not $sav !
            GUICtrlSetState($save,$GUI_ENABLE)
        EndSelect
WEnd

HardCopy


Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Just a few typos is all.

HardCopy

this is more than beautiful

big thanks to 'HardCopy'

Edited by star2

[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]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

this is more than beautiful

big thanks to 'HardCopy'

I didn't know that it could do that :( Oh well. If you can't beat the best, join the best??? Is that it??? :shocked:

EDIT: Spelling....

Edited by Bert

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

INFO UPDATED

thanks to " HardCopy "

the conditions were in the input fields were modified the save button will be enabled

but if I erase the fields contents it keeps enabled

so I've added this to the script and it worked perfectly

Case    GUICtrlRead($put1)="" Or  GUICtrlRead($put2)=""
         GUICtrlSetState ($save,$GUI_DISABLE)
oÝ÷ Ú«¨µéÚ

HardCopy

Edited by star2

[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]

Share this post


Link to post
Share on other sites

Updated !!

#include <GUIConstants.au3>
GUICreate("test", 400, 200)
GUISetFont(12)
GUICtrlCreateLabel("please select your picture", 8, 4)
$put1 = GUICtrlCreateInput("", 8, 25, 200, 25)
$open = GUICtrlCreateButton("select picture", 214, 25, 150, 25)
GUICtrlCreateLabel("enter your name please", 8, 60)
$put2 = GUICtrlCreateInput("", 8, 80, 200, 25)

$save = GUICtrlCreateButton("Save", 44, 150, 200, 25)
GUICtrlSetState ($save,$GUI_DISABLE)
GUISetState()
GUICtrlSetFont ($put1, 9)
$s = 2
While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
            if $msg = $open Then
                $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)")
                If Not @error Then GUICtrlSetData($put1,$sFile)
                EndIf
                     
            If fileexists (GUICtrlRead($put1)) = 1  and GUICtrlRead($put2) Then
                If BitAND(GUICtrlGetState($save), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($save, $GUI_ENABLE)
                EndIf
            EndIf
            If fileexists (GUICtrlRead($put1)) = 0  Or GUICtrlRead($put2) = "" Then
                If BitAND(GUICtrlGetState($save), $GUI_disable) <> $GUI_disable Then
                    GUICtrlSetState($save, $GUI_disable)
                EndIf
            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]

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