Sign in to follow this  
Followers 0
markitus90

Problem with gui inputbox

10 posts in this topic

Hi sirs,

I have a problem with a inputbox. The insered numbers are never used and always replaced by 3 and 4.

I am grateful for your help.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Guicombobox.au3>
#Region ### START Koda GUI section ### Form=c:\users\marco aurelio\desktop\koda\forms\xy coordenate.kxf
$Form1_1 = GUICreate("Form1", 405, 326, 318, 175)
$n1 = GUICtrlCreateInput("", 16, 48, 130, 21)
$n2 = GUICtrlCreateInput("", 160, 48, 130, 21)
$Combo = GUICtrlCreateCombo("Type", 320, 48, 73, 25)
GUICtrlSetData(-1, "Addition|Substraction")
$Begin = GUICtrlCreateButton("Start", 128, 184, 153, 57)
Dim $Form1_1_AccelTable[1][2] = [["s", $Begin]]
GUISetAccelerators($Form1_1_AccelTable)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$refresh = GUIGetMsg()
Switch $refresh
  Case $GUI_EVENT_CLOSE
   Exit
  Case $n1

  Case $n2
  Case $Combo
  Case $Begin
   if _GUICtrlComboBox_GetCurSel($Combo) = 1 then MsgBox(0,'','')
   if _GUICtrlComboBox_GetCurSel($Combo) = 2 then GUICtrlRead($n1)
   if _GUICtrlComboBox_GetCurSel($Combo) = 2 then GUICtrlRead($n2)
   if _GUICtrlComboBox_GetCurSel($Combo) = 2 then MsgBox(0, '', $n1 + $n2)
   MsgBox(0, '', $n1 & ' ' & $n2)
EndSwitch
WEnd

Share this post


Link to post
Share on other sites



Hi Jos,

i have used GUICtrlRead($n1) for the first number and GUICtrlRead($n2) for the second number.

Is not correct? Why?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What do you do with the Value you retrieve, it currently goes nowhere..

Just store it in a Variable and use that in the msgbox()

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Ok,

so Im trying to do a simple addition with 2 numbers insered manually, but i cant because scite takes always for the first number 3 and 4 the second.

Thanks for help!

Share this post


Link to post
Share on other sites

Hi Markitus90. But you're not using it in your Msgbox. Try:

MsgBox(0, '', GUICtrlRead($n1) & ' ' & GUICtrlRead($n2))

And as Jos mentioned, currently you're pulling the data, but not really doing anything with it.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Try something like this for your return:

MsgBox(0, '', GUICtrlRead($n1) + GUICtrlRead($n2))

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Nice!!

Problem solved!

just a bit negligence.

Thanks to all

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

markitus90,

Look at your "if" statements. You repeat a case three times...

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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  
Followers 0