Skip to main content
gamedev.net
🔒 Locked

Creating a GUI...

Started by NumberSeven Jul 21, 2003 at 4:37 PM 3 replies 650+ views
Original Post
NumberSeven
NumberSeven
Hi, I recently decided to make my very own Graphical User Interface.I read the article(s) at gamedev.net(Creating a GUI in DirectX [1...4]), it is a little complicated though.I kinda know how the code strcture would look like, but don''t know how everything should work.Could anyone tell me more about it, by it i mean communication between windows and other controls, etc.. Thanks.
Fletch
Fletch
You should read the article here at gamedev. It''s pretty good.
raven_soul
raven_soul
quote:
Original post by Fletch
You should read the article here at gamedev. It''s pretty good.


quote:
Hi,
I recently decided to make my very own Graphical User Interface.I read the article(s) at gamedev.net(Creating a GUI in DirectX [1...4]) , it is a little complicated though.I kinda know how the code strcture would look like, but don''t know how everything should work.Could anyone tell me more about it, by it i mean communication between windows and other controls, etc..

Thanks.


Fletch, I believe he already answered that. I bolded the text in his post.
Fletch
Fletch
quote:
Original post by raven_soul
quote:
Original post by Fletch
You should read the article here at gamedev. It''s pretty good.


quote:
Hi,
I recently decided to make my very own Graphical User Interface.I read the article(s) at gamedev.net(Creating a GUI in DirectX [1...4]) , it is a little complicated though.I kinda know how the code strcture would look like, but don''t know how everything should work.Could anyone tell me more about it, by it i mean communication between windows and other controls, etc..

Thanks.


Fletch, I believe he already answered that. I bolded the text in his post.



Ra! My bad, sorry. That''ll teach me to skip ahead while reading.

The basic idea is to use inheritance in such a way that every gui control is a "window"

window
-button IS A window
-list box IS A window
-dialog box IS A window

now, all of the controls can be stored in a list, or some other structure like below:

Linkedlist<*window> listofwindows;

now each of the controls and windows have the ability to store other windows and controls. Because each of the children are also "windows", they inherit the functionality of the "window" class.

The window class has certain functions such as "onDoubleClick"

In your code, when someone double clicks the screen, your base window would execute the onDoubleClick function like this:

mainwindow->onDoubleClick(x,y);

Now, for this to work, you would have to find the child that resides at the point where you double clicked on the screen. This is covered in the article. This child could be the child of a child, of a child of a parent, several plies deep. Once you find the child that is supposed to get the message, and have it''s pointer, then it''s onDoubleClick() function can be executed.

The onDoubleClick function would be specific to that control, so a double click on a listbox would do something different than a doubleclick on a button.

Anyhow, that''s basically it. Of course the gui can get really complicated, and Microsofts editor for instance does a lot of behind the scenes things that you would have to implement manually in your gui, unless you made a similar editor.

Ok, anytime I can confuse you more, just ask!
Trienco
Trienco
quote:
Original post by Fletch
The onDoubleClick function would be specific to that control, so a double click on a listbox would do something different than a doubleclick on a button.


which would in other words mean that for every single button youre going to use you would have to derive your own button with the right onclick function.
thats why im using a click function for "fixed" results (setting state to pressed/not pressed, etc.) and calling onclick which is a callback to a user defined function (currently within the dialogue class)

f@dzhttp://festini.device-zero.de

Topic Locked

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

Sign in to reply to this topic.