| View previous topic :: View next topic |
| Author |
Message |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Sep 13, 2008 7:33 pm Post subject: [C++] GUI Calculator |
|
|
Well, I decided to make a simple calculator with a GUI using ResEdit. For now, all this calculator is meant to do is add. Would I use a dialog? Similar to this?
[
* Number 1 goes in first box
Number 2 goes into second box
Answers shown in popup.
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Sep 13, 2008 7:47 pm Post subject: |
|
|
or create an array of int and i
use GetDlgItemInt and increment i (for the array stored) and use 1 edit box and 9 buttons each with a number, and buttons for +, -, *, /, power, etc
and a button for clear
when clear is called, i = 0
when a modifier is called, the operation is performed and stored in the current array
so say array[0] = 5 and array[1] = 10 (i = 1)
array[i] = array[i-1] modifier array[i]
this way you can keep a running total of the calc until the clear is called.
and display array[i] in the edit box after modifying.
I guess you could even use 2 int array and just call GetDlgItemInt and you will have the last used number.
Just a little rant and is in no way the entire process. Just some brainstorming
_________________
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Sep 13, 2008 7:53 pm Post subject: |
|
|
| blankrider wrote: | or create an array of int and i
use GetDlgItemInt and increment i (for the array stored) and use 1 edit box and 9 buttons each with a number, and buttons for +, -, *, /, power, etc
and a button for clear
when clear is called, i = 0
when a modifier is called, the operation is performed and stored in the current array
so say array[0] = 5 and array[1] = 10 (i = 1)
array[i] = array[i-1] modifier array[i]
this way you can keep a running total of the calc until the clear is called.
and display array[i] in the edit box after modifying.
I guess you could even use 2 int array and just call GetDlgItemInt and you will have the last used number.
Just a little rant and is in no way the entire process. Just some brainstorming |
Heh, thanks. But, I'm just going to keep it adding only for now. I'm not too experienced with win32/gui's so im going to stay simple till i get a bit of experience from this.
Anyways, Once I've made my desired GUI through ResEdit and added the newly made .rc and .h files to my project, what do I use for the actual source file? Make a window and hide it? or just <include> what is needed ?
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Sep 13, 2008 7:58 pm Post subject: |
|
|
uhm, why would you make a window and hide it if the window is going to be your gui? I don't get you. If you compile with the WIN32GUI switch then you won't get a cmd line.
and look up using dialogs as a window.
and for this, i would not use a dialog, but rather CreateWindow each of the windows(controls) in your project.
_________________
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Sep 13, 2008 8:03 pm Post subject: |
|
|
Thanks for your effort blankrider, the lack of communication is due to my lack of knowledge on the topic (my apologies).
How exactly do you create the GUI through the window? What I had done was create the main GUI interface on a dialog
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
|
| Back to top |
|
 |
|