PDA

View Full Version : [Ver 1.1] Ext.ux.Calculator



tjstuart
13 Aug 2007, 4:34 PM
Version 1.1 of Ext.ux.Calculator now available @ http://extjs.com/learn/Extension:Calculator

Only two new features:-

1. Added 'CE' (clear last entry) button
2. Added visual feedback when keyboard/numpad is used

Cheers

Toby Stuart

jsakalos
14 Aug 2007, 3:46 PM
Good!

Nice to see it's getting better and better. Could you please post any future plans with this calc?

Cheers,

tjstuart
14 Aug 2007, 5:49 PM
Saki,

As I'm busy with a large project at the moment I will not be adding to this component for at least a couple of months. The calculator as it is supports our requirement perfectly.

I imagine version 2.0 of the calculator will support a 'scientific' mode and memory add/recall etc.

In the meantime, I'm happy for others to contribute to its development and will act quickly on any completed working submissions.

Regards

Toby Stuart

jsakalos
15 Aug 2007, 12:23 AM
Hi Toby,

thanks for info. I won't need it for a couple of months; then we can come back to the subject. :)

Cheers,

Nullity
21 Aug 2007, 8:05 AM
I had planned on writing my own calculator, but yours is already shaping up pretty well. I hope you don't mind, I played around with it and have added several new features:



Added Memory buttons/functions (store, add, recall, clear)
Added Backspace button/function
Added some Quicktips (can be enabled/disabled)
Several CSS changes/additions


I am also planning on adding a scientific mode and was going to wait until I finished that before I posted, but I thought some might find this one useful for now. I still plan to add a scientific mode to it as time permits.

The source and a screenshot are attached below (sorry, I don't have a public server to host a demo).

In case anyone was wondering, the empty space in the upper-left corner is an indicator to specify if something is stored in the memory (which has a quicktip that gives you it's value).

tjstuart
21 Aug 2007, 5:21 PM
Thanks Nullity. Great work! I'll update the demo page and download etc. but before I do ... there appears to be a bug :) To replicate:-

1. Enter '100'
2. Press 'MS'
3. Press 'C'
4. Enter '500'
5. Press '+'
6. Press 'MR'
7. Press '='

You get 1000 where you should get 600. Other than that it looks great well done :)

Cheers

Nullity
22 Aug 2007, 7:03 AM
oops, sorry about that. I attached a fixed version.

(also includes a couple other small fixes)

tjstuart
22 Aug 2007, 4:55 PM
Thanks Nullity. Works fine now. I have updated the user extensions page and the calculator demo page.

http://extjs.com/learn/Extension:Calculator
http://www.figtreesystems.com/ext/ext-ux/1.1/Calculator/Calculator.html

Cheers

tjstuart
22 Aug 2007, 10:16 PM
Nullity,

Also found a little bug which I've fixed in 1.3.

"Fixed bug when pressing backspace after loading initial number via setValue (eg. setting intial value via trigger field) [Toby Stuart]"

Cheers

Nullity
23 Aug 2007, 6:24 AM
Wonderful, thank you!

l0co
28 Jan 2008, 7:17 AM
There is a bug in calculator which appears in opera, in line 70:



var row = this.stTable.createChild({tag: 'tr'}).child('tr');


You mean the "tr" element, so I don't know what is the child() for. I don't know also why does it work in FF/IE, but in Opera it doesn't. The fix for all browsers is:



var row = this.stTable.createChild({tag: 'tr'});

tjstuart
6 Feb 2008, 3:01 PM
There is a bug in calculator which appears in opera, in line 70:



var row = this.stTable.createChild({tag: 'tr'}).child('tr');


You mean the "tr" element, so I don't know what is the child() for. I don't know also why does it work in FF/IE, but in Opera it doesn't. The fix for all browsers is:



var row = this.stTable.createChild({tag: 'tr'});


Thanks l0co. I haven't done a calculator release for some time. I'll add it too my ever growing list of things to do :)

jsakalos
6 Feb 2008, 3:08 PM
Toby,

any chance you would port this calculator to Ext 2.0 NumberField plugin and that you'd add priority of operations (1+2*3=7, not 9)?

tjstuart
10 Feb 2008, 3:02 PM
Toby,

any chance you would port this calculator to Ext 2.0 NumberField plugin and that you'd add priority of operations (1+2*3=7, not 9)?

Hi Saki,

It's not high up on my list of things to do. I wrote it for a large project that is using Ext1.x. When I move the project to Ext2 I will do the port. Can't say when that will be however.

jsakalos
10 Feb 2008, 5:05 PM
Ok, thanks for info. It's not very high also on my priority list to have the calc so no problem.

Cheers,

jelt
16 Mar 2008, 1:05 AM
Hi, calculator seem to be a nice feature that i plan to use :)

A little calculation bug you can see in demo page :
7
*
2.1
=
14.700000000000001

tjstuart
24 Mar 2008, 4:15 PM
For anyone that's interested I've made a more Ext'ish style for the calculator.



.ux-calc {
background: #C7D8ED;
}
.ux-calc-container {
border: 1px solid #718BB7;
}
.ux-calc-container .ux-calc-btn-row td {
font-family: tahoma, arial, helvetica, sans-serif;
font-size: 10px;
line-height: 18px;
border: 1px solid #8DB2E3;
}
.ux-calc-digit, .ux-calc-equals {
font-weight: bold;
}
.ux-calc-operator, .ux-calc-equals {
color: blue;
}
.ux-calc-memory {
color: #1E3B72;
}
.ux-calc-memstore {
border: 1px solid #8DB2E3 !important;
background-color: #D1D1D1;
}
.ux-calc-btn-hover {
background: #8DB2E3;
cursor: pointer;
}
.ux-calc-input {
text-align: right;
}

.ux-calc-misc { }
.ux-calc-ok {
padding-top:5px;
padding-bottom:5px;
border-top: 1px solid #8DB2E3;
}

j_butterfly
27 Mar 2008, 6:54 PM
thanks for your sharing,
I want use it,but I use EXT2...
I think this migrate to EXT2.0 is better.

andreydjason
22 Apr 2008, 9:59 AM
Hello friends...

I would like to use this wonderful calculator in a Window, can I? How I do it?

Greetings!

...Sorry for my English, I am Brazilian :-)

tjstuart
23 Apr 2008, 4:01 PM
@j_butterfly - no support for Ext2. Wouldn't be difficult to port though I havent the time at the moment.

@andreydjason - do you mean an Ext2 window? If so, see message above. No support for Ext2 at the moment.

lucbinhdinh
16 Apr 2013, 7:08 AM
demo no player!!!
help:">:">

lucbinhdinh
16 Apr 2013, 7:11 AM
demo no player
help me
thanhks!!!