Sign in to follow this  

Help, GUI development!

Recommended Posts

Hi all, I'm a beginner in GUI development. I'm using MFC SDI to develop GUI. One thing that I'm confused is that how do you mantain all the GUI/Application states. Let say, you have an application level state called COLOR. this COLOR can be changed by clicking left click mouse, keyboard input and clicking on the toolbar. How do you manage this state? Obvious and not so good one is to handle it one by one, responding to each event: i.e. OnMouseClick() { if left click change color } OnKeyboardInput() { change color } OnToolbarClick() { change color } A better one is calling one global function: i.e. OnMouseClick() { if left click UpdateColor() } OnKeyboardInput() { UpdateColor() } OnToolbarClick() { UpdateColor() } the problem is there are too many states and the states may trigger another event (and affects app behaviour). How do we handle this ? Currently I put all the states handling function in one class (singleton class) and every event that changes any states will call a corresponding function from the singleton class. Could you please help?? I think that this is not so correct... regards, tep

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this