Design question (GUI)

Started by
4 comments, last by Melekor 19 years, 11 months ago
I''m making my own gui framework in C(rendered with opengl). The way it works is pretty much like win32, each window has a window proc, etc. It''s going great except for one problem. To do a hit-test, I have a window message called WM_HITTEST. This is used in several functions, for instance WindowFromPoint. The problem is, if one of these functions are called from inside a WM_HITTEST callback, it enters an infinite loop and stack overflow quickly ensues. How can I solve this problem in an elegant way? Any tips/ideas are much appreciated, and remember this is with C, not C++. Thanks, Melekor
Advertisement
Even the Windows API tells you not to change the focus in response to a set focus message. The same problem as yours will occur. It is up to the user to avoid these situations.
hm, really? Where does it say that in the docs?
I tried the setfocus thing with win32 and it doesn''t make my app crash. I also tried sizing the window in response to a WM_SIZE message, and that didn''t crash it either. Obviously windows is somehow handling this problem, but I don''t know how.
Bump. Can I get a second or third opinion? (even if only to confirm what the AP said)
Thanks.

edit: missing letter

[edited by - Melekor on May 19, 2004 5:56:56 PM]
I am trying to design my own GUI right now but its probally not as advanced as yours ( or as pretty )

I have been infulenced much by the simplicity of java sctipt events applied to webpage objects and each of my gui objects must have a similar inter face.

Events include
OnLbuttonDown
OnLbuttonUp
OnMouseOver
etc...
These are the most common and usefull. I have a struct with a call back function and an argument so I can do something like this:
Button::OnLbuttonUp( point& p ){   if( collide_with_button(p) )   {      m_ButtonUpCallBack.Call();   }}


I dont have to worry about any infinate loop with the way I am designing it.

Mabe you send messages to the parent window and that causes an infinate loop. I dont need to send any messages. Sorry I couldnt be of more help. Mabe you could post some code.




gdipong

oglpong Online (43% complete)


If you got any requests or suggestions post here

[edited by - try_catch_this on May 19, 2004 6:30:03 PM]
I''ve designed my own GUI as well and don''t quite follow the problem, having never faced and loops like this

. Is the problem that when an event occurs that causes another event the code loops?

Answer: Post new events to a seperate event list and handle them on the next iteration(frame etc)?

Thats if I read your problem properly...
Chris Brodie

This topic is closed to new replies.

Advertisement