Jump to content

Problem with gui inputbox


Recommended Posts

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
Link to comment
Share on other sites

  • Developers

You need to use GuiCtrlRead() to retrieve the Control value, you now retrieve the handle.

Jos :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Try something like this for your return:

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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