Sign in to follow this  
Followers 0
myspacee

some info about while

6 posts in this topic

hello to all.

i did a script that send a formatted email for my monkey users

all works fine but i have few question about *while* cicle

my script is composed:

__________________________________________________________________________

variable declaration

mask

input box

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button1

;##################################

; send mail

;##################################

Case $msg = $Button2

;##################################

; send mail and continue

;##################################

Case $msg = $Button3

Exit

EndSelect

Wend

my functions

__________________________________________________________________________

button 1 send mail and all is ok

i want that when button b is pressed all elements of my mask will be reset to null

(variables, input box, date, notes, combo box) so my users can continue to use script.

How can i correct my work?

Thank you to all

And sorry for bad english

Share this post


Link to post
Share on other sites



I can't tell what button B is but after:

Case $msg = $Button1

You would use GUICtrlSetData for each form element to set it back to default.

Share this post


Link to post
Share on other sites

thanks for reply...

any example for GUICtrlSetData and 'resetting' form?

M.

Share this post


Link to post
Share on other sites

thanks for reply...

any example for GUICtrlSetData and 'resetting' form?

M.

There is no "fun" or "magic" way of doing it like in HTML.

#include <GUIConstants.au3>

Dim $input1Default = "John"
Dim $input2Default = "Smith"
Dim $checkbox1Default = $GUI_UNCHECKED
Dim $checkbox2Default = $GUI_CHECKED

GUICreate("My GUI", 400, 250)  ; will create a dialog box that when displayed is centered

GUICtrlCreateLabel("Value 1", 10, 13)
$input1 = GUICtrlCreateInput($input1Default,50, 10, 200)

GUICtrlCreateLabel("Value 2", 10, 43)
$input2 = GUICtrlCreateInput($input2Default,50, 40, 200)

$checkbox1 = GUICtrlCreateCheckbox("Check 1", 10, 73)
GUICtrlSetState (-1,$checkbox1Default)
$checkbox2 = GUICtrlCreateCheckbox("Check 2", 10, 103)
GUICtrlSetState (-1,$checkbox2Default)

$reset = GUICtrlCreateButton("Reset", 170, 200, 60, 20)

GUISetState ()       ; will display an empty dialog box with a combo control with focus on

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    Switch $msg
        Case $GUI_EVENT_CLOSE 
            ExitLoop
        Case $reset
            GuiCtrlSetData($input1, $input1Default)
            GuiCtrlSetData($input2, $input2Default)
            
            GuiCtrlSetState($checkbox1, $checkbox1Default)
            GuiCtrlSetState($checkbox2, $checkbox2Default)
    EndSwitch
Wend

Share this post


Link to post
Share on other sites

weaponx,

perfect.

Thank you very much.

M.

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