[RESOLVED] Showing the buttons pressed in a GUI Application
Hello there, i have a program with 5 buttons:
Abyssal Scepter -> Writes something into ChampionName-SummonersRift.txt
Aegis of the Legion -> Same thing, different id
Beep -> Send a Beep Sound
Show File Content -> Show What is currently in ChampionName-SummonersRift.txt
AutoBuddy.... -> Simple MessageBox with a Static text
Quit -> Terminates the program and removes that last character of the .txt file
I want the "Beep" button to show on screen what buttons have been pressed (Not keyboard button, the GUI's buttons) [EX: You have pressed This,That,This,These ]
What can i do?
Please help
Code: http://pastebin.com/haHBShVp
Re: Showing the buttons pressed in a GUI Application
I can't find the edit button.
1.I have now readed the rules.
2.The project has been attached.
3.I want the Output ( list of the GUI's buttons that have been pressed) to be shown ONScreen in a pop-up window (Just how the "Show file Content" button works
4.//IF POSSIBLE: I want to be able to select (Via mouse1) & copy the text in that window.
Thank you
Re: Showing the buttons pressed in a GUI Application
Originally Posted by n0thing17
I can't find the edit button.
I hope you will find it after four or five posts.
Originally Posted by n0thing17
3.I want the Output ( list of the GUI's buttons that have been pressed) to be shown ONScreen in a pop-up window (Just how the "Show file Content" button works
In case of MessageBox it should work with Ctrl+C to copy into the clipboard.
1.I hope too.
2.I don't know how to tell the program to show what buttons have been pressed but i know how to create the Messagebox (Does it make sense? | "I want the "Beep" button to show on screen what buttons have been pressed (Not keyboard button, the GUI's buttons) [EX: You have pressed This,That,This,These ]
What can i do?")
3.I know i can Ctrl+C, Ctrl+C copies all, including the Title and the "OK" button // How can i select only a few words?
Re: Showing the buttons pressed in a GUI Application
Originally Posted by n0thing17
2.I don't know how to tell the program to show what buttons have been pressed but i know how to create the Messagebox (Does it make sense? | "I want the "Beep" button to show on screen what buttons have been pressed (Not keyboard button, the GUI's buttons) [EX: You have pressed This,That,This,These ]
What can i do?")
I guess you handle the "button-press" for all your buttons in a window procedure. So depending on the button ID you could determine which button has been pressed...
Originally Posted by n0thing17
3.I know i can Ctrl+C, Ctrl+C copies all, including the Title and the "OK" button // How can i select only a few words?
Then the easiest way would be implementing your own dialog window with the feature of "copy only the text you need".
Re: Showing the buttons pressed in a GUI Application
Originally Posted by VictorN
I guess you handle the "button-press" for all your buttons in a window procedure. So depending on the button ID you could determine which button has been pressed...
Then the easiest way would be implementing your own dialog window with the feature of "copy only the text you need".
I only understand only Very Basic Stuff of C++, atleast tell me what function to use to "handle" the button-pressed?
//EDIT : Copy pasting from the window is not that important.
Re: Showing the buttons pressed in a GUI Application
Let's get back to the basics. In the program that you want to capture the button clicks, do you want to modify this program (and have the source code to modify)?
Or do you want to intercept the button clicks without modifying the original program?
Re: Showing the buttons pressed in a GUI Application
I want the "Beep" button to show on screen what buttons have been pressed (Not keyboard button, the GUI's buttons) [EX: You have pressed This,That,This,These ]
What can i do?
Use a vector of string. In the event handler for each button you want to show later, add the required text to the vector. In the event handler for the beep button, simply show the various elements of the vector in a messagebox (or how you want to display them) and then clear the vector.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
Re: Showing the buttons pressed in a GUI Application
Originally Posted by 2kaud
Use a vector of string. In the event handler for each button you want to show later, add the required text to the vector. In the event handler for the beep button, simply show the various elements of the vector in a messagebox (or how you want to display them) and then clear the vector.
I think i know what you are talking about. I hope'd there is a better way of doing that (Main program has 190 buttons ) Silly me. I will edit my comment when i am done. If some problem pops-up i will let you know.
Thank you!
Re: Showing the buttons pressed in a GUI Application
Originally Posted by 2kaud
Use a vector of string. In the event handler for each button you want to show later, add the required text to the vector. In the event handler for the beep button, simply show the various elements of the vector in a messagebox (or how you want to display them) and then clear the vector.
Originally Posted by VictorN
It sounds like not a good or just poor design!
I don't know how to create a "vector of string", i just created a normal string and tried adding some text while in append mode. Failed
Can you guys help more ? I know you consider this task easy...but for me is hard. Otherwise i will do the only thing i know to do, make another txt file and assigning the Buttons to write the Actual name of the Buttons [I.Ex, i Press XY....program writes XY.. in the txt file]
If the event handler for all these buttons are from the WM_COMMAND message, then in the initial code for WM_COMMAND just write the control ID to a vector instead of a string and then use a look-up table to get a text message from a control ID - or you could obtain the button window text from the id etc etc - so you won't need different code for each button, the same short piece of code will serve for all buttons.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
Re: Showing the buttons pressed in a GUI Application
Originally Posted by n0thing17
I hope'd there is a better way of doing that
There really is. Button clicks come to window procedure in a form of WM_COMMAND. So, you can intercept the clicks in one place and collect the button names as button window texts showing at the moment of pressing.
Re: Showing the buttons pressed in a GUI Application
Originally Posted by Igor Vartanov
There really is. Button clicks come to window procedure in a form of WM_COMMAND. So, you can intercept the clicks in one place and collect the button names as button window texts showing at the moment of pressing.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.