![]() |
|
#1
|
|||
|
|||
Menu Bar and Pop-up window conflictI'm writing an FLTK chess client which lets two people connect over a TCP/IP connection and play a game of chess. It work pretty well but I have found one bug which I think is a result of the way FLTK is handling events. I have an option that lets a play request an undo. When this option is selected a modal window will pop up on the opponents screen and say something like "opponent requests an undo." with a "yes" and "no" button. Most of the time this works fine. The problem is if the player receiving the undo request is in a menu (that is, the menu bar item is active and being drawn): when the pop-up window appears the program locks up. The mouse works and everything, but it seems that neither the menu nor the window (or any other widget) is able to receive mouse or keyboard events. Does anyone have an idea of a fix around this problem? I'd also like to understand what widgets (if any) are suppose to receive events in a case like this.
One simple thing that I did think of trying is simply forcefully closing the menu before the window pops up, but I can't seem to find a Fl_Widget or Fl_Menu_* function that does what I want. Here's a small program that recreates the problem. Start it up and hit the 'z' key and you'll see a window. Hit yes or no, and the window should close fine. Now click on the "File" menu and while the menu bar is open hit the 'z' key again. The program should lockup at this point. main.cpp: CPP / C++ / C Code:
I know I can use a call to fl_choice() to accomplish a similar task but I'd prefer to have the pop up window be custom. Also, I feel like the way I store the response in the window user_data might be kind of kludgy. If you have any suggestions on a better way to do this, it'd be greatly appreciated as well. Thanks in advance for any help you can provide. |
|||
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The