Windows form

closed account (o2ASLyTq)
Hello!

My question is, how do I add a button with such properties so that when I click it the window that is open changes?

To simplify my meaning; I have a "Create an account button" when I click the button I want the window to change totally into another window where you can choose your name and password. I do not want a new window to be created.

What I don't want to happen is that when you press a button a new window pops up. (An example would be that if you press a button on youtube a new window pops up, that wouldn't be so nice, because if you press on 10different videos 10 windows would pop up, I don't want that to happen)

Greetings!
Typical answers:

(1) it actually is another window, located in the same place and with the same size as the first window

(2) a "panel" (something of a widget container) is swapped in the window

Either way, you've got some learning to do. What framework are you using? WinAPI? Qt? FLTK?
closed account (o2ASLyTq)
I am a total beginner with GUI, I would even dare to say that I am a beginner with C++ aswell but I just want to take things to the next level :)

And about the framework, I wish I knew what it was :P
closed account (o2ASLyTq)
You're probably sitting back and laughing at me :P
Nobody laughs at people of a lower skill level than themselves (unless they have social problems).

Do you have existing code that you want to add a button to or are you posting this with no existing code at all?
LB + 1

Rethinking the question, are you asking something about a web page?
closed account (o2ASLyTq)
The thing is that I got an task to make a vocabulary trainer, so I have made the first window, with two buttons, one says "Create an account" The other says "Login". What I want is that when I press the button "Create an account" a new window replaces the old window and then you can choose your name and password. But a new window should not be opened, it need to be the same window, so there is only 1 window opened the whole time.

Hope I made it more clear this time :)
Last edited on
closed account (o2ASLyTq)
Also Duoas mentioned theese things " WinAPI? Qt? FLTK? ". What is it and what is it used for? :)

Greetings!
What did you use when you "made the first window with two buttons"?
closed account (o2ASLyTq)
I am working in Visual studio 2012. I forgot, I took for granted that everybody did :P

I just used the windows form and made the button aswell as the window from there.
Last edited on
Hello,

I am not a user of Microsoft Visual C++, but expect that it works pretty much the same as what I use. There should be an attribute named Visible or something close to that on the buttons, edit boxes, etc. that you wish to use on your form (window). You can design the layout for each of the input 'boxes' that you want to create, and turn the Visible attribute on and off as required for the different stages of your program.

If this is for an assignment, I understand the logic behind using the same window. If it is for what you hope to be using as an actual application, I would suggest that you use separate windows (popups) for your login etc. If you do this, you only have to activate the windows that you want visible when you want them visible which is more efficient for you as the programmer, and more importantly for your application and users.

Largins
closed account (o2ASLyTq)
Is somebody familiar with using windows form in visual studio 2012? Because there is no video, no guide or help out there, and the book I got is just pure crap. Because the coding doesn't work exactly the same way as C++ I am guessing?
Life would be very much simple for you if you create another form... With its own window, and make it a modal dialogue box to ask the user for name and password. Your "create" button could then just call the dialogue to get the info. I'm not at my PC at the moment and I'm not yet familiar enough with VS to tell you what buttons to press to add a new form , but it will give you a new cpp and h file to your project.

Playing around with toggling visibility on controls is trickier...
closed account (o2ASLyTq)
Well, should I use another program? Because there is no help out on the web for windows form with visual studio 2012, doesn't work the same way as the older ones, already tried. However the programming language needs to be C++ because that's the subject that I have picked in school. So do you guys have any suggestion where you can program with C++ and it needs to be graphic, I don't want to make the programs with a cmd window. And what about the QT and other stuff that were listed earlier in the thread, what are they?

You can probably guess that I am novice at this.

Greetings
I don't know windows forms so I don't know if there is a way to do what you are wanting. If you were using Java, the simple solution would be to use a card layout. That basically does what has already been suggested and opens a new window were the old one was.

QT is a popular GUI library that should have something similar, but you would be better off using the IDE that comes with it than trying to integrate the library into Visual Studio. wxWidgets is another popular GUI library that plays well with Visual Studio and most other IDEs as far as I know.

It might be easier (or harder?) to think of everything in a GUI as a window including buttons. Layout managers take care of most of the drudgery of positioning, sizing, and other management tasks for all the "widows" in your GUI. Every library is going to do all that differently and how well any of it fits your needs depends on what you are trying to do overall.

Duoas' suggestion sounds like it will do what you want with what you are working with though.
The Microsoft Reference manual for VC++ 2012 can be found here:

http://msdn.microsoft.com/en-us/library/vstudio/60k1461a%28v=vs.110%29.aspx

Largins
Topic archived. No new replies allowed.