I'm taking my first venture into programming a GUI using C++. Specifically, I'm using Microsoft Visual C++ 2010 Express.
I have created a Windows Form and created my main Window roughly the way I want it. However, the way I intend for the program to work is to have the main Window divided into 2 sections. One section will be the main viewing area, and this area will change it's contents after a user has clicked on a button. The second area will be static and not change.
Since I am new to building GUIs to go along with my program, I cannot figure out how to accomplish this. The best I've been able to figure out so far is to use a TabControl and resize it so that the tabs are not visible in the Window. This solution could work, but does not seem to be very good practice. So, what might be a good way to go about this?
I hope I explained my idea clearly, but if not, please let me know and I'll clarify if I can.
Thanks for the quick response!
I already have the two sections created, so that's not the problem. The problem is, I want the contents of the main viewing area to change when a button is pressed. Aside from using a TabControl as I described, or cluttering up the GUI builder, I don't know of a good way to do this.
What I am wanting to do is kind of like a web browser. You have the main area where the web page is shown, and when you navigate to different websites just that area of the program changes. You don't have to recreate the whole window.
Here's a little mockup done in paint:
This is my splash screen, the user will start here http://i.imgur.com/srAYmA4.jpg
Once the user clicks on any of the buttons on the screen, the main viewing area contents will change to something like this: http://i.imgur.com/PX3aIt0.jpg
I'm trying to figure out how to do that.
Sorry i'm afraid I won't be much help as I don't know about GUI builders, plus I have never had the need to make a dynamically changing UI like that. I speculate that if I wanted to accomplish this I would either
- Create an object, similar to a factory, that manages the placement and visibility of the various UI components and use it to construct the UI on-the-fly, or
- Like your tabcontrol solution, construct separate windows for each unique view, make each window a child of the main window, and have only one visible at a time.
Thank you AHCFan20. I'm not sure what a factory is, so I'm going with your something along the lines of your second idea. Thank you very much.
It wasn't so much a need to make the dynamic UI, I am actually just rewriting a year old Java application in Visual C++ for the sake of an updated and less clunky GUI and increased efficiency. I always used Eclipse for Java, so I wrote the GUI by hand. The GUI builder makes things easier once you figure it out (which I haven't quite yet, haha).
It's funny, as an intern and student, going back and looking at year old code I wrote when I first started my internship. I compare it to what I would do now, and I want to get mad at the past me, haha.