Sign in to follow this  
Followers 0
XInFisk

Need help with a GUI script.

2 posts in this topic

Hey.. I need help with a script i have made in v3.1.1.133 (beta)...

(Plus = -)

(Minus = +)

(Gange = *)

(Dividere = /)

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)
$mainwindow = GuiCreate("Regne Hax0r", 350, 320)
$Minus = GuiCtrlCreateButton("Minus", 0, 0, 350, 80)
$Plus = GuiCtrlCreateButton("Plus", 0, 80, 350, 80)
$Gange = GuiCtrlCreateButton("Gange", 0, 160, 350, 80)
$Dividere = GuiCtrlCreateButton("Dividere", 0, 240, 350, 80)

GuiSetOnEvent($Minus, "Minus")
GuiSetOnEvent($Plus, "Plus")
GuiSetOnEvent($Gange, "Gange")
GuiSetOnEvent($Dividere, "Dividere")
GUISetOnEvent($GUI_EVENT_CLOSE, "ex")

GUISetState(@SW_SHOW)

While 1
  Sleep("50")
WEnd

Func Minus()
  $m1 = InputBox("Minus","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $m2 = InputBox("Minus","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $m3 = Execute("$m1-$m2")
      MsgBox(0, "Lortet giver:", $m3)
EndFunc

Func Plus()
  $p1 = InputBox("Plus","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $p2 = InputBox("Plus","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $p3 = Execute("$p1+$p2")
      MsgBox(0, "Lortet giver:", $p3)
EndFunc

Func Gange()
  $g1 = InputBox("Gange","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $g2 = InputBox("Gange","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $g3 = Execute("$g1*$g2")
      MsgBox(0, "Lortet giver:", $g3)
EndFunc

Func Dividere()
  $d1 = InputBox("Dividere","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $d2 = InputBox("Dividere","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $d3 = Execute("$d1-$d2")
      MsgBox(0, "Lortet giver:", $d3)
EndFunc


Func ex()
  Exit
EndFunc

But when i open it then i try to push one of the buttons.. lets say "Minus" but nothing happends.. it want it to use the "Func Minus()"... Can anyone help me with that :lmao:?

Share this post


Link to post
Share on other sites



if you didn't already figure it out, you need to use GuiCtrlSetOnEvent

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)
$mainwindow = GuiCreate("Regne Hax0r", 350, 320)
$Minus = GuiCtrlCreateButton("Minus", 0, 0, 350, 80)
$Plus = GuiCtrlCreateButton("Plus", 0, 80, 350, 80)
$Gange = GuiCtrlCreateButton("Gange", 0, 160, 350, 80)
$Dividere = GuiCtrlCreateButton("Dividere", 0, 240, 350, 80)

GuiCtrlSetOnEvent($Minus, "Minus")
GuiCtrlSetOnEvent($Plus, "Plus")
GuiCtrlSetOnEvent($Gange, "Gange")
GuiCtrlSetOnEvent($Dividere, "Dividere")
GUISetOnEvent($GUI_EVENT_CLOSE, "ex")

GUISetState(@SW_SHOW)

While 1
  Sleep("50")
WEnd

Func Minus()
  $m1 = InputBox("Minus","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $m2 = InputBox("Minus","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $m3 = Execute("$m1-$m2")
      MsgBox(0, "Lortet giver:", $m3)
EndFunc

Func Plus()
  $p1 = InputBox("Plus","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $p2 = InputBox("Plus","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $p3 = Execute("$p1+$p2")
      MsgBox(0, "Lortet giver:", $p3)
EndFunc

Func Gange()
  $g1 = InputBox("Gange","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $g2 = InputBox("Gange","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $g3 = Execute("$g1*$g2")
      MsgBox(0, "Lortet giver:", $g3)
EndFunc

Func Dividere()
  $d1 = InputBox("Dividere","Regne Hax0r", ""," ","-1","-1","-1","-1")
  $d2 = InputBox("Dividere","Regne HaX0r", ""," ","-1","-1","-1","-1")
    $d3 = Execute("$d1-$d2")
      MsgBox(0, "Lortet giver:", $d3)
EndFunc


Func ex()
  Exit
EndFunc

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

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