Jump to content

Auto Accountant GUI help


WillG
 Share

Recommended Posts

Hi, I'm a real noob at this, but I have adapted (tried to) a command program to make one for my friend who is starting a (very) small business by selling food at his boarding school. My goal is for the finished application to have 6 columns of different types of food each with text boxes above containing the quantity of food inputed by the user, set prices of each column, and "process" buttons below. I want there to be a text form at the lower right hand corner showing the profits. When a button is clicked, i want it to subtract one from the text box above it, and add its cost to the 'profits' box. If it's possible, i would like the application to save everything in all the boxes when it closes. Thank you very much, Will

Unfortunately it's not in working order because i don't know haow to add/subtract things in text boxes

Global $iscut = 0
Opt ("WinWaitDelay", 20); If the value is less, it's more easy to move the window.
Opt ("GuiResizeMode", 800);
Local $move = 0, $offset

;gui variables, rather then including guiconstants..
$WS_POPUP = 0x80000000
$WS_BORDER = 0x00800000
$BS_DEFPUSHBUTTON   = 0x0001

$hWnd = GUICreate("GT AutoAccountant", 430, 300, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
$border = GUICtrlCreateLabel(FileGetShortName("T&R Inc."), 0, 0, 340, 18)
GUICtrlSetResizing($border, "")
GUICtrlSetBkColor($border, 0x00FF00)
$cmdbase = GUICtrlCreateInput("1")
$cmd = GUICtrlCreateInput("", 5, 50, 20, 20)
$cmd = GUICtrlCreateInput("", 85, 50, 20, 20)
$cmd = GUICtrlCreateInput("", 165, 50, 20, 20)
$cmd = GUICtrlCreateInput("", 240, 50, 20, 20)
$cmd = GUICtrlCreateInput("", 320, 50, 20, 20)
$cmd = GUICtrlCreateInput("", 400, 50, 20, 20)
$output = GUI
$ctrlzlabel = GUICtrlCreateLabeL("GT", 5, 75, 200)
GUICtrlSetFont($ctrlzlabel, 9, 400, 0, "Arial")
$exec = GUICtrlCreateButton("Process", 5, 100, 50, 25, $BS_DEFPUSHBUTTON)
$exec2 = GUICtrlCreateButton("Process", 85, 100, 50, 25, $BS_DEFPUSHBUTTON)
$exec3 = GUICtrlCreateButton("Process", 165, 100, 50, 25, $BS_DEFPUSHBUTTON)
$exec4 = GUICtrlCreateButton("Process", 240, 100, 50, 25, $BS_DEFPUSHBUTTON)
$exec5 = GUICtrlCreateButton("Process", 320, 100, 50, 25, $BS_DEFPUSHBUTTON)
$exec6 = GUICtrlCreateButton("Process", 400, 100, 50, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetTip($exec, "Click when a customer has purchased this item")
GUICtrlSetTip($exec2, "Click when a customer has purchased this item")
GUICtrlSetTip($exec3, "Click when a customer has purchased this item")
GUICtrlSetTip($exec4, "Click when a customer has purchased this item")
GUICtrlSetTip($exec5, "Click when a customer has purchased this item")
GUICtrlSetTip($exec6, "Click when a customer has purchased this item")
$close = GUICtrlCreateButton("X", 380, 0, 20, 20)
GUICtrlSetTip($close, "Exit")
$min = GUICtrlCreateButton("V", 360, 0, 20, 20)
GUICtrlSetTip($min, "Minimize")
$cut = GUICtrlCreateButton("^", 340, 0, 20, 20)
GUICtrlSetTip($cut, "Cut window")
GUISetState(@SW_SHOW, $hWnd)
While 1
   $get = GUIGetMsg()
   If $get = $close Then Exit
   If $get = $min Then GUISetState(@SW_MINIMIZE, $hWnd)
   If $get = $cut Then
      If $iscut = 0 Then
         Opt ("WinWaitDelay", 1)
         $winpos = WinGetPos($hWnd)
         $iscut = 1
         For $i = 100 To 20 Step - 1
            WinMove($hWnd, "", $winpos[0], $winpos[1], 400, $i)
         Next
      ElseIf $iscut = 1 Then
         $winpos = WinGetPos($hWnd)
         $iscut = 0
         For $n = 20 To 100 Step 1
            WinMove($hWnd, "", $winpos[0], $winpos[1], 400, $n)
         Next
      EndIf
   EndIf
   If $move Then
      $mousepos = MouseGetPos()
      WinMove($hWnd, "", $mousepos[0] + $x_offset, $mousepos[1] + $y_offset)
   EndIf
   If $get = $border Then
        $move = Not $move
        if $move Then
            GUICtrlSetCursor($border, 9)
        Else
            GUICtrlSetCursor($border, -1)
        Endif
      $mousepos = MouseGetPos()
      $winpos = WinGetPos($hWnd)
      $x_offset = $winpos[0] - $mousepos[0]
      $y_offset = $winpos[1] - $mousepos[1]
   EndIf
   If $get = $exec Then
      _ExecCommand(GUICtrlRead($cmd))
      _ExecCommand2(GUICtrlRead($cmdbase))
   EndIf
WEnd

Func _ExecCommand($command);based off SlimShady's _Execute command! :D
   $command = StringReplace($command, '"', '""')
   StringReplace($command, '"', '"')
   RunWait(@AutoItExe & ' /c "Exit(' & $command & ')"', @WorkingDir)
EndFunc;==>_ExecCommand 

Func _ExecCommand2($command2)
    $command2 = 

Func Clear()
    GUICtrlSetData($cmd, "", "")
EndFunc
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...