Jump to content

Am I going nuts? What am I doing wrong?


Recommended Posts

Hello.. I would appreciate if someone could help me out, I think I'm going crazy..

I was writing a quite simple script, in a form of many other scripts I have written.

It consists of a simple GUI with some fields and a button, when the button is pressed some calculations are being made, and I get something in an Edit Control. But it's like when I press the button, the values that are passed are "insane"..

I've tried debugging it, so I started stripping any calculations and useless stuff. The simplest form I've gone to is the following:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>


$Form1 = GUICreate("", 400, 400)

$hLblA = GUICtrlCreateLabel("Input Α =", 16, 72, 99, 23)

$InputA = GUICtrlCreateInput("", 120, 72, 73, 21)

$hLblB = GUICtrlCreateLabel("Input Β =", 16, 104, 98, 23)

$InputB = GUICtrlCreateInput("", 120, 104, 73, 21)

$hLblC = GUICtrlCreateLabel("Input C =", 16, 144, 84, 23)

$InputC = GUICtrlCreateInput("", 104, 144, 49, 21)

$hLblD = GUICtrlCreateLabel("Input D =", 48, 176, 52, 23)

$InputD = GUICtrlCreateInput("", 104, 176, 49, 21)

$hBtn = GUICtrlCreateButton("Button", 248, 112, 89, 33)

$hEdit = GUICtrlCreateEdit("", 96, 256, 225, 129, BitOR ($ES_MULTILINE, $ES_READONLY))

GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $hBtn
            
            GUICtrlSetData ($hEdit, $InputA)

    EndSwitch
WEnd

As you can see, the code is very straightforward, when the button is pressed, I should just get in the edit control box what I entered as Input A.

BUT the output is a bit crazy. I leave the field empty (or I type anything), and as soon as I press the button, I get "4" in the edit control.

Please, tell me, am I going crazy? Or is there anything VERY simple that I'm overlooking?

Edited by scripterman
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...