Skip to main content
gamedev.net
🔒 Locked

Help, GUI development!

Started by stephanus Jun 6, 2006 at 3:50 AM 0 replies 350+ views
Original Post
stephanus
stephanus
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
StephanusSIWare, Inchttp://graphics.harvestsoft.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.