Jump to content
Sign in to follow this  
scripterman

Am I going nuts? What am I doing wrong?

Recommended Posts

scripterman

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

Share this post


Link to post
Share on other sites
somdcomputerguy

Try this GUICtrlSetData ($hEdit, GUICtrlRead($InputA))..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
scripterman

Try this GUICtrlSetData ($hEdit, GUICtrlRead($InputA))..

I KNEW I was overlooking something VERY VERY simple.. How could I be so distracted.. Must be very tired.. Thanks

Share this post


Link to post
Share on other sites
somdcomputerguy

You bet. Get some Sleep() :blink:;)


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.