News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A little calculator

Started by NoCforMe, August 27, 2023, 08:00:39 AM

Previous topic - Next topic

NoCforMe

The latest "product" from NoCforMe Laboratories, GmbH: a small calculator for your evaluation.

Fixed-point only, no floating point. Does basic arithmetic ops, plus shift left/right (by 1 bit). Displays in decimal or hex. Can copy result (or whatever happens to be in the calculator edit field) to the clipboard. Pretty basic. Works, so far as our limited testing here can tell.

The most complex part of coding this? Nothing having to do with the calculator code; it was the code that handles updating the edit field from the calculator buttons. I've started a new topic on this in the Workshop.

There is one problem I haven't been able to solve, would appreciate any help. It's totally cosmetic; I'm drawing a nice border around the edit control (the one that receives user input and shows the result), but that border doesn't show when the program starts. It only shows either when one of the number buttons is clicked, or if you mouse over the edit control.

I'm pretty sure I've found the cause of this, but not the reason: the edit control sits on top of a static control which I use as a "container" field; it gets filled with a bitmap that shows the rounded border on top. If I take this control out the edit control works as expected, so something about having this static underneath it is causing trouble. I don't really understand why, since the only thing I'm doing with that static is filling it with a bitmap, using STM_SETIMAGE. There's no interaction with it other than that. Not a huge problem, but annoying.

Have fun playing with this, and of course please let me know if you find any problems, other than the one described above. (I'm sure there are no bugs in here.  :biggrin: )
Assembly language programming should be fun. That's why I do it.

jj2007

Great job, and no problem with borders :thumbsup:

One minor suggestion: I am used to the Windows calc.exe, so I hit Escape to clear the field... which didn't work as expected :wink2:

NoCforMe

OK, noted. In fact, everyone please give me your suggestions. This is only version 1. I'll start on the next version when I have enough material.
Assembly language programming should be fun. That's why I do it.

Biterider

Hi NoCforMe

Quote from: NoCforMe on August 27, 2023, 08:00:39 AMNoCforMe Laboratories, GmbH
:cool:

Cool program!  :thumbsup:

I am using Win10 Home 22H2 and have noticed a glitch when starting calc.exe. When the app first pops up, the border of the input control does not appear. When I move the mouse over it, it appears and remains visible from then on.

Biterider

NoCforMe

Yes, that's the cosmetic problem I pointed out. Happens to me w/Windows 7-64 as well. As I said, I know what's causing the problem but I don't know why it's causing it. Annoying.
Assembly language programming should be fun. That's why I do it.

Vortex


stoo23

Cool, it has a kinda nice Old 'retro' look about it, you almost Expect it to make the Sounds those old large Accounting department calculators with the big crank handles on the side used to make  :wink2:  :thumbsup:

Maye Retro' Audio in version 2 ??,..  :bgrin:

NoCforMe

Quote from: stoo23 on September 09, 2023, 07:07:23 PMMaye Retro' Audio in version 2 ??,..  :bgrin:

Hey, I never thought of that. Not a bad idea. "Ka-chunk!" when you click one of them buttons ...
Assembly language programming should be fun. That's why I do it.

stoo23

 :smiley:

https://youtu.be/aDN4s8ElxqE

 :cool:  :thumbsup:

NoCforMe

OK, you asked for it. Try this baby out. (Yeah, it might get annoying after a while. Need to put a sound on/off control in it somewhere ...)
Assembly language programming should be fun. That's why I do it.

stoo23

 :smiley:

Maybe each Button could just have a single 'click' (much like a typewriter), with the 'Kachunk' saved purely for the Major functions like creating an addition or Total etc  :smiley:

jj2007

Quote from: NoCforMe on September 10, 2023, 05:44:10 PMOK, you asked for it. Try this baby out. (Yeah, it might get annoying after a while. Need to put a sound on/off control in it somewhere ...)

Nice :thumbsup:

Have you considered using Gdi+ for the controls, to round the edges a bit?

NoCforMe

Actually no. I like your rounded "window" on top better than mine (which is a bitmap that's a little jaggy). I like my "steampunk" buttons better, though.

Did you use a rounded rectangle function for that (like GDI's RoundRect() but the GDI+ version)?
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on September 10, 2023, 08:08:23 PMDid you use a rounded rectangle function for that (like GDI's RoundRect() but the GDI+ version)?
It's a series of GdipAddPathArcI invokes.