Jump to content

Recommended Posts

Posted

Can anyone give me a hand with this? Its got me very confused. This is a gui with an input box...i want $job to be whatever the result of $jobinput (description input box) is. When i click the OK button i should get a confirmation message of what $job is but im getting a blank message box. This tells me that it not actually receiving what is being entered into the inputbox. What am i doing wrong? Im sure its something very simple.

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

$Form1 = GUICreate("HPOV", 549, 580, 325, 169)

$joblabel=GUICtrlCreateLabel("Job Description", 48, 16, -1, 30)

$jobinput=GUICtrlCreateInput("", 48, 61, 409, 100)

$job=GUICtrlRead($jobinput)

GUICtrlSetData($jobinput, $job)

GUISetState(@SW_SHOW)

$ok = GUICtrlCreateButton("Ok", 48, 464, 97, 33)

$cancel = GUICtrlCreateButton("Cancel", 248, 464, 97, 33)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

case $ok

MsgBox(0,"title", $job)

case $cancel

MsgBox(4096, "Test", "Closing...", 1)

Exit

EndSwitch

WEnd

Thanks alot

Tim

Posted (edited)

very simple you are reading the control when its blank

you should make a button when pressed would set the value of $job by reading the Input

Edit: if still confused this would do the work

;Modified by - Phoenix XL


#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("HPOV", 549, 580, 325, 169)

$joblabel = GUICtrlCreateLabel("Job Description", 48, 16, -1, 30)
$jobinput = GUICtrlCreateInput("", 48, 61, 409, 100)
GUISetState(@SW_SHOW)

$ok = GUICtrlCreateButton("Ok", 48, 464, 97, 33)
$cancel = GUICtrlCreateButton("Cancel", 248, 464, 97, 33)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$cancel
ExitLoop
Case $ok
$job = GUICtrlRead($jobinput)
MsgBox(0, "Job", $job)
EndSwitch
WEnd

GUIDelete()

Br

Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

Ahhhhhh Thanks so much! So to verify it wasn't working because it was linking $job to $jobinput straight away instead of when the $ok button was pushed...makes sense!

Thanks again

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
×
×
  • Create New...