Jump to content



Photo

Calculator --> My version


  • Please log in to reply
6 replies to this topic

#1 farhan879

farhan879

    Wayfarer

  • Active Members
  • Pip
  • 81 posts

Posted 26 October 2008 - 05:50 PM

I made a calculator. Its pretty simple and basic and works fine. It may come in handy at times. :P

Source
AutoIt         
#cs ----------------------------------------------------------------------------         Pogram  Version: 1.0         Author:         Farhan         Script Function: Calculates maths     © Copyright 2008. All rights reserved. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=f:\my documents\koda form designer\koda_1.7.0.1\forms\calc.kxf $Form2 = GUICreate("Calculator", 210, 190, 303, 222) $Result = GUICtrlCreateInput("", 8, 8, 193, 21) $clear = GUICtrlCreateButton("Clear", 128, 40, 73, 25, 0) $One = GUICtrlCreateButton("1", 8, 104, 35, 25, 0) $Zero = GUICtrlCreateButton("0", 8, 136, 35, 25, 0) $Point = GUICtrlCreateButton(".", 48, 136, 33, 25, 0) $Equal = GUICtrlCreateButton("=", 88, 136, 115, 25, 0) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Two = GUICtrlCreateButton("2", 48, 104, 33, 25, 0) $Three = GUICtrlCreateButton("3", 88, 104, 33, 25, 0) $Four = GUICtrlCreateButton("4", 8, 72, 35, 25, 0) $Five = GUICtrlCreateButton("5", 48, 72, 35, 25, 0) $Six = GUICtrlCreateButton("6", 88, 72, 35, 25, 0) $Seven = GUICtrlCreateButton("7", 8, 40, 35, 25, 0) $Eight = GUICtrlCreateButton("8", 48, 40, 35, 25, 0) $Nine = GUICtrlCreateButton("9", 88, 40, 35, 25, 0) $Times = GUICtrlCreateButton("x", 128, 72, 35, 25, 0) $Plus = GUICtrlCreateButton("+", 128, 104, 33, 25, 0) $Divide = GUICtrlCreateButton("/", 168, 72, 33, 25, 0) $Minus = GUICtrlCreateButton("-", 168, 104, 33, 25, 0) $Menu_file = GUICtrlCreateMenu("&File") $Menu_about = GUICtrlCreateMenuItem("About", $Menu_file) $Menu_exit = GUICtrlCreateMenuItem("Exit", $Menu_file) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetBkColor(0x494e48) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $Menu_about             MsgBox(64, "About", "Product name:   Calculator" & @CRLF & "Author:              Farhan (farhan_879@hotmail.com" & @CRLF & "Version:             1.0" & @CRLF & "" & @CRLF & "© Copyright 2008. All rights reserved.")         Case $Menu_exit             Exit         Case $One             calc(1)         Case $Two             calc(2)         Case $Three             calc(3)         Case $Four             calc(4)         Case $Five             calc(5)         Case $Six             calc(6)         Case $Seven             calc(7)         Case $Eight             calc(8)         Case $Nine             calc(9)         Case $Zero             calc('nul')         Case $Divide             calc('/')         Case $Times             calc('x')         Case $Equal             calc('get')         Case $Plus             calc('+')         Case $Minus             calc('-')         Case $Point             calc('.')         Case $clear             GUICtrlSetData($Result, '')     EndSwitch WEnd Func calc($num)     If $num = 'get' Then         get()     Else         If $num = 'nul' Then             GUICtrlSetData($Result, GUICtrlRead($Result) & 0)         Else             GUICtrlSetData($Result, GUICtrlRead($Result) & $num)         EndIf     EndIf EndFunc   ;==>calc Func get()     $p = Execute(StringReplace(GUICtrlRead($Result), 'x', '*'))     If @error Then         GUICtrlSetData($Result, 'Syntax ERROR')     Else         GUICtrlSetData($Result, $p)     EndIf EndFunc   ;==>get


Enjoy :(


Attached File  Calculator_1.0.zip   230.04K   329 downloads

Edited by farhan879, 27 October 2008 - 04:49 AM.

Posted ImageSystem task ---> My first GUICalculator v1.0 ---> My version of the calculatorNetZilla 1.0 --> Web browserEmail Sender --> You can Send emails with this without opening a web browser





#2 LimeSeed

LimeSeed

    Adventurer

  • Active Members
  • PipPip
  • 148 posts

Posted 26 October 2008 - 11:52 PM

I made a calculator. Its pretty simple and basic and works fine. It may come in handy at times. :P
Enjoy :(
Attached File  Calculator_1.0.zip   230.04K   329 downloads

awesome, you might want to check out my calculator for ideas! i worked really hard on it, and its multilingual :idea: but good work!
global $warming = true

#3 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,340 posts

Posted 27 October 2008 - 03:25 AM

Can I ask why you didn't post the source? Seems a bit simple. Source isn't really secret, with something like this.

It does what it say, although simple.

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#4 farhan879

farhan879

    Wayfarer

  • Active Members
  • Pip
  • 81 posts

Posted 27 October 2008 - 04:52 AM

@LimeSeed
Thanks for the positive comment :P I'll be sure i'll check your calculator out! :idea:

@Firestorm
I edited my post :(
Posted ImageSystem task ---> My first GUICalculator v1.0 ---> My version of the calculatorNetZilla 1.0 --> Web browserEmail Sender --> You can Send emails with this without opening a web browser

#5 Cw2K1

Cw2K1

    Wayfarer

  • Active Members
  • Pip
  • 79 posts

Posted 27 October 2008 - 03:48 PM

simple but cool :P
Enjoy the complexity.Feel the power of simplicity.

#6 logmein

logmein

    Polymath

  • Active Members
  • PipPipPipPip
  • 214 posts

Posted 26 November 2008 - 07:41 AM

you should add some func like : sprt, sin, cos, tan, quare root...
Using WIndows Calculator were better.:-)

#7 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 26 November 2008 - 12:12 PM

looks nice!..
the _calc function looks a bit like mine: (look at sig for my calc)
(these are the last 50 lines of my code:)
Plain Text         
        Case $9             calc(9)                     Case $o             calc('nul')         Case $deel             calc('/')         Case $keer             calc('x')         Case $is             calc('get')         Case $plus             calc('+')         Case $min             calc('-')         Case $c             calc('.')         Case $clear             GUICtrlSetData($som, '' )     EndSwitch WEnd func calc($num)     if $num='get' then         get()     Else         if $num='nul' then             GUICtrlSetData($som, GUICtrlRead($som)&0)         Else             GUICtrlSetData($som, GUICtrlRead($som)&$num)         EndIf     EndIf EndFunc func get()     $p = Execute(StringReplace(GUICtrlRead($som), 'x', '*'))     if @error then         GUICtrlSetData($som, 'Error' )     Else         GUICtrlSetData($som, $p )     EndIf EndFunc

:)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users