Sign in to follow this  
Followers 0
Qual-IT London

Inputbox

3 posts in this topic

does anyone know if you use an input box how you can clear it?

#include <GUIConstants.au3>

dim $share,$uname,$pw

$Main = GUICreate("input",320,200)

$sharen = GuiCtrlCreateInput($share, 120, 55, 170, 20)

$usname = GuiCtrlCreateInput($uname, 120, 80, 170, 20)

$pwd = GuiCtrlCreateInput($pw, 120, 105, 170, 20)

$Submit = GuiCtrlCreateButton("Add", 120,140,70,20)

GuiSetState(@SW_SHOW,$main)

If Not WinActive($Main) Then WinActivate($Main)

While 1

$msg = GUIGetMsg()

select

Case $msg = $GUI_EVENT_CLOSE

exit (3)

Case $msg = $submit

$share = GuiCtrlRead ($sharen)

$uname = GuiCtrlRead ($usname)

$pw = GuiCtrlRead ($pwd)

for $i = 1 to 1

if $share = "" Then

msgbox (16,"Question","Please give input")

exitloop

endif

iniwrite ("~netfldr.qbw", $share,"Name",$share)

if not $uname = "" Then IniWrite ( "~netfldr.qbw", $share, "User", $uname )

if not $pw = "" Then IniWrite ( "~netfldr.qbw", $share, "Password", $pw )

GUICtrlSetData($share, '')

GUICtrlSetData($uname, '') ; <------ here im tryin to clear the boxes to take

GUICtrlSetData($pw, '') the input again!

guictrlclose()

GuiSetState(@SW_SHOW,$main)

next

EndSelect

WEnd

GUIDelete()

Exit

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You have to set the data of the control, not the text.

You try to clear these:

GUICtrlSetData($share, '')

GUICtrlSetData($uname, '') ; <------ here im tryin to clear the boxes to take

GUICtrlSetData($pw, '') the input again!

But these are the controls:

$sharen = GuiCtrlCreateInput($share, 120, 55, 170, 20)

$usname = GuiCtrlCreateInput($uname, 120, 80, 170, 20)

$pwd = GuiCtrlCreateInput($pw, 120, 105, 170, 20)

Edited by greenmachine

Share this post


Link to post
Share on other sites

You have to set the data of the control, not the text.

You try to clear these:

GUICtrlSetData($share, '')

GUICtrlSetData($uname, '') ; <------ here im tryin to clear the boxes to take

GUICtrlSetData($pw, '') the input again!

But these are the controls:

$sharen = GuiCtrlCreateInput($share, 120, 55, 170, 20)

$usname = GuiCtrlCreateInput($uname, 120, 80, 170, 20)

$pwd = GuiCtrlCreateInput($pw, 120, 105, 170, 20)

doh!

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