Jump to content

CtrlRead not Working


 Share

Recommended Posts

Hi guys, I got a problem with my script. I inserted an 'input control' and a 'button' for displaying the text (that has been entered in input)

Have a look at this:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <winapifiles.au3>
#include <Clipboard.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <GuiScrollBars.au3>
#include <ColorConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
#include <APIGdiConstants.au3>
#include <ButtonConstants.au3>
#include <array.au3>

;_____________________________________________________________
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
Opt("GUICloseOnESC", 0) ;1=ESC  closes, 0=ESC won't close
;__________________________________________________________

Global $maingui = GUICreate("myCalculator",500,400,-1,-1)

Global $bcalc = GUICtrlCreateButton("CALCULATE",360,200,100,30)

Global $input1 = GUICtrlCreateInput("",180,50,80,22)

Global $iRead1 = GUICtrlRead($input1)

GUICtrlSetOnEvent($bcalc,"myfunction")

GUISetOnEvent($GUI_EVENT_CLOSE,"sclose")

GUISetState(@SW_SHOW)
While 1
    Sleep(100) ; Sleep to reduce CPU usage
WEnd
;_______________________________________________


func sclose()
    Exit
EndFunc


Func myfunction()
    MsgBox(0,"",$iRead1)
    EndFunc

 

 

So this was the script and on running it, it shows messagebox but with no content. I want to display the text which has been entered in input box. Have you got any idea about this..

I have inserted the ..au3 file with this topic.

Example Script.au3

Link to comment
Share on other sites

Hi,

please post your code using the <> in the menu..

Try this:

Global $maingui = GUICreate("myCalculator",500,400,-1,-1)

Global $bcalc = GUICtrlCreateButton("CALCULATE",360,200,100,30)

Global $input1 = GUICtrlCreateInput("",180,50,80,22)

;~ Global $iRead1 = GUICtrlRead($input1)

GUICtrlSetOnEvent($bcalc,"myfunction")

GUISetOnEvent($GUI_EVENT_CLOSE,"sclose")

GUISetState(@SW_SHOW)
While 1
    Sleep(100) ; Sleep to reduce CPU usage
WEnd
;_______________________________________________


func sclose()
    Exit
EndFunc


Func myfunction()
    MsgBox(0,"", GUICtrlRead($input1))
    EndFunc

 

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