Jump to content

GUICtrlRead mistake


trdunsworth
 Share

Go to solution Solved by BrewManNH,

Recommended Posts

Ok,

I'm sure this is something I'm missing, but I am going to ask so I can get this moving in the right direction. I've created a tabbed form which would take input from a user and write that input to a html form locally and eventually also push that data to another website elsewhere. That part shouldn't be a big deal, but I'm having a problem with GUICtrlRead and it only giving me what I'm guessing is the ID number of the input. Here's abbreviated code for clarity.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#include <IE.au3>
#include <InetConstants.au3>
#include <StringConstants.au3>
#include <FileConstants.au3>

; Changes to OnEvent Mode
Opt('GUIOnEventMode', 1)

GuiCreate("JCSO NCIC Entry", 1500, 900)
GUISetIcon("icon.ico")
Global $sFont = "Calibri"

;Menu Creation
Local $filemenu = GUICtrlCreateMenu("&File")
Local $helpmenu = GUICtrlCreateMenu("?")
Local $openItem = GUICtrlCreateMenuItem("&Open", $filemenu)
Local $saveItem = GUICtrlCreateMenuItem("&Save", $filemenu)
Local $infoItem = GUICtrlCreateMenuItem("Info", $helpmenu)
Local $exitItem = GUICtrlCreateMenuItem("E&xit", $filemenu)

;Tab Creation
GUICtrlCreateTab(0,0,1500,880)

;Tab 1 Creation
;==================================================
GUICtrlCreateTabItem("License Plate")

GUICtrlCreateLabel("Message Key (MKE)", 20, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Originating Agency (ORI)", 20, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate No. (LIC)", 20, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate St. (LIS)", 20, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Expiration Year (LIY)", 20, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate Type (LIT)", 20, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Theft (DOT)", 20, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Case Number (OCA)", 20, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("NCIC Number (NIC)", 20, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Agency Id (LKI)", 20, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Case Number (LKA)", 20, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Notify Originating Agency (NOA)", 20, 480, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Miscellaneous Info (MIS)", 20, 520, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)

Local $Fmke = GUICtrlCreateInput("", 225, 40, 200, 25)
Local $mke = GUICtrlRead($Fmke, 1)
Local $Fori = GUICtrlCreateInput("", 225, 80, 200, 25)
Local $Flic = GUICtrlCreateInput("", 225, 120, 200, 25)
Local $Flis = GUICtrlCreateCombo("", 225, 160, 200, 25)
Local $Fliy = GUICtrlCreateInput("", 225, 200, 200, 25)
Local $Flit = GUICtrlCreateCombo("", 225, 240, 200, 25)
Local $Fdot = GUICtrlCreateDate("", 225, 280, 200, 25, $DTS_SHORTDATEFORMAT)
Local $Foca = GUICtrlCreateInput("", 225, 320, 200, 25)
Local $Fnic = GUICtrlCreateInput("", 225, 360, 200, 25)
Local $Flki = GUICtrlCreateInput("", 225, 400, 200, 25)
Local $Flka = GUICtrlCreateInput("", 225, 440, 200, 25)
Local $Fnoa = GUICtrlCreateInput("", 225, 480, 200, 25)
Local $Fmis = GUICtrlCreateInput("", 225, 520, 200, 150)

Local $secondLabel = GUICtrlCreateLabel("ENTRY & SECOND PARTY CHECK", 550, 40, 200, 75)
GUICtrlSetFont($secondLabel, 10, 700, 6, "Calibri", 5)
GUICtrlCreateLabel("", 500, 60, 200, 75)
GUICtrlCreateLabel("Date Received", 500, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Entry", 500, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Second Party Check", 500, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Modify Date", 500, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Clear, Cancel, or Locate Date", 500, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Officer/Agency", 500, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)

Local $FdateRecd = GUICtrlCreateDate("", 675, 80, 200, 25, $DTS_SHORTDATEFORMAT)
Local $Fofc = GUICtrlCreateInput("", 675, 120, 200, 25)
Local $Fdoe = GUICtrlCreateDate("", 675, 160, 200, 25, $DTS_SHORTDATEFORMAT)
Local $Fop1 = GUICtrlCreateInput("", 675, 200, 200, 25)
Local $Fdo2 = GUICtrlCreateDate("", 675, 240, 200, 25, $DTS_SHORTDATEFORMAT)
Local $Fop2 = GUICtrlCreateInput("", 675, 280, 200, 25)
Local $Fdom = GUICtrlCreateDate("", 675, 320, 200, 25, $DTS_SHORTDATEFORMAT)
Local $Fop3 = GUICtrlCreateInput("", 675, 360, 200, 25)
Local $Fdoc = GUICtrlCreateDate("", 675, 400, 200, 25, $DTS_SHORTDATEFORMAT)
Local $Fop4 = GUICtrlCreateInput("", 675, 440, 200, 25)

;Button 1
GUICtrlCreateButton("REJIS Entry", 1390, 760, 100, 30)
GUICtrlSetOnEvent(-1, 'Function1a')

;Button 2
GUICtrlCreateButton("Print Preview", 1390, 800, 100, 30)
GUICtrlSetOnEvent(-1, 'Function2a')

;Button 3
GUICtrlCreateButton("Print Form", 1390, 840, 100, 30)
GUICtrlSetOnEvent(-1, 'Function3a')

Func Function2a()
    ;Hides the GUI while the function is running
    ;GUISetState(@SW_HIDE)
    Local $oIE = _IECreate("http://jcsoarch:8099/licensePlate.html")
    Local $oForm = _IEFormGetObjByName($oIE, "licensePlate")
    Local $oMke = _IEFormElementGetObjByName($oForm, "mke")
    _IEFormElementSetValue($oMke, $mke)
EndFunc

If I put anything in the First input box, when I hit Print Preview, it opens the form nicely and inserts 83 in the first text box, rather than anything I've actually put in that field.

I know it has to be simple to get, but it's evading me right now.

Pointing me in the right direction is most appreciated, thanks in advance.

Link to comment
Share on other sites

You're reading from the control as soon as you create it, there's nothing in $mke at that point, although I'm not sure why you're using the advanced parameter in there or what it would normally return for an input control.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I was using it because I thought that I needed it. Clarifying that for me is great. Thanks. Ok, if I'm understanding you correctly, I'm missing another step in the process. I need to fix the value as whatever the user will enter, then read that.

That helps me try to think of what to do next.

I love the Avatar. If I may ask, what lodge?

Link to comment
Share on other sites

  • Solution

You need to read from the input after someone has put something into it, so usually a button is used to tell the program that you're ready to read from the controls and to send the contents.

 

Rising Sun Lodge #39 in NH (USA)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thank you for that! I hadn't paid attention to my old code and I'd done that in something else I'd written a couple of years ago. In fact, I was just explaining it to someone today, so I get the braindead award for that.

It's nice to encounter another brother here. I'm from Independence Lodge #76 in Missouri myself.

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