-
Posts
1331 -
Joined
-
Last visited
Single Status Update
-
Here is a code for a calculator using GUI and event driven programming. One annoying problem is that the numbered buttons call the action method twice. Suggestions to improve the program is much appreciated.
EDIT: An error found. Putting 0s in front of numbers might manipulate the calculation a bit.
code:
Array-
Regarding the registering each action twice, that's because you're just listening for all events without filtering them out by type (e.g. button pressed, button released, etc.), and even buttons can generate many kinds of events, not just "pressed". Whenever you click on a button, you generate at least a "button pressed" and "button released" event, while I think there's also a "button clicked" event which only triggers upon a complete press-release cycle.
-
-
-