<br><div class="gmail_extra">(cc racket-list, as it can be useful information)<br><br><div class="gmail_quote">On Tue, Nov 27, 2012 at 5:55 PM, Kieron Hardy <span dir="ltr">&lt;<a href="mailto:kieron.hardy@gmail.com" target="_blank">kieron.hardy@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF"><div>Are you trying to show the popup without the frame actually being shown? i.e. C-f1 before C-f2</div>

</div></blockquote><div><br>No, the frame is already shown when I call C-F1<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF"><div></div>

<div>Have you tried using queue-callback? i.e. Allow the system to complete processing of the key (C-f1) event before having it deal with showing the popup?</div></div></blockquote><div><br>That was a good shot, but unfortunately it doesn&#39;t work either.<br>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF"><div></div><div>Do you have any calls to printf or anything else that requires another thread to run?</div>

</div></blockquote><div><br>Before I added them, no I did not have anything else than (send f popup-menu ...)<br><br>Laurent<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div bgcolor="#FFFFFF"><div><div class="h5"><div><br>On Nov 27, 2012, at 9:25, Laurent &lt;<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite">

<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 27, 2012 at 3:58 PM, Kieron Hardy <span dir="ltr">&lt;<a href="mailto:kieron.hardy@gmail.com" target="_blank">kieron.hardy@gmail.com</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><div>Laurent, do you have a bit of code that demonstrates your issue?</div></div>



</blockquote><div>
<br>Well, it&#39;s not easy to show a minimal example, as it (seems to) depends on an X event loop processing while grabbing the root window.<br><br>But I have something like that:<br>[...]<br>; create a new event space and use it for all graphics<br>



(define gui-eventspace (make-eventspace))<br>(current-eventspace gui-eventspace)<br>
[...]<br><br>(define menu2 (new popup-menu% [...])<br>(define f (new frame% [label &quot;Frame&quot;]))<br>(define cb (new button% [parent f] [label &quot;Menu&quot;] <br>    [callback (λ(cb ev)(send f popup-menu menu2 100 150))]))<br>



<br>; keybindings to run commands <br>(add-bindings global-keymap<br> &quot;C-F1&quot; (thunk* (send f popup-menu menu2 100 100))<br> &quot;C-F2&quot; (thunk* (send f show #t)) ; to show the frame after the event loop has started<br>



)<br><br>[...]<br><br>(run-event-loop)<br><br><br>When the program starts, I press Ctrl-F2 to show the frame, and then I can press the button to show the popup, several times in a row, and the popup menu does work correctly.<br>



But if I press Ctrl-F1 to show the popup menu by attaching it directly to the frame instead of going through the callback, not only does it not show up, but after that pressing the button does not work anymore (actually, I can press the button and it changes its state, so it&#39;s not frozen, but the popup menu just does not appear).<br>



<br>I&#39;ve tried to surround the call inside the first thunk* with a `thread&#39; and also with a `(parameterize ([current-eventspace (make-eventspace)])&#39; or with the gui-eventspace just in case, but without success.<br>



<br>Laurent<br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><div><div><div><br><br>On Nov 27, 2012, at 4:09, Laurent &lt;<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>&gt; wrote:<br>




<br></div></div></div><div><div><div></div><blockquote type="cite"><div>Update:<br>Independently of the server and the keybindings:<br>If I create a frame with a button which callback pops up a menu, it works.<br>
If I create a frame and call popup-menu on it directly, it fails (the menu does not appear, and the button above does not show its own menu anymore either, which may mean something about eventspaces being frozen? Although I can still click on another button that hides the frame)<br>






<br>Any idea? I&#39;m kind of stuck in the eventspace...<br><br>Laurent<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 26, 2012 at 4:55 PM, Laurent <span dir="ltr">&lt;<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>&gt;</span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There is a remaining problem: I can show frames and buttons alright, and press them, but popup-menus seem to resist (although the frame I call show-popup-menu on does show up). <br>






<br>What&#39;s strange is that they work when called from the console (in a different thread, in a different namespace with eval, but with namespace-anchor), but not via a keybinding (in the main thread, and in the main namespace), and I could not yet reproduce this behavior in a simpler setting than in the server thread...<br>







<br>Is there something special about popup-menus?<span><font color="#888888"><br><br>Laurent</font></span><div><div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 25, 2012 at 6:30 PM, Laurent <span dir="ltr">&lt;<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>&gt;</span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It works! Thank you very much!<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></blockquote></div></div><div><blockquote type="cite"><div><span>____________________</span><br><span>  Racket Users list:</span><br><span>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a></span><br>




</div></blockquote></div></div></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>