<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 27, 2012 at 5:43 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is the callback than handles the c-f1 keystroke running in<br>
gui-eventspace or in some other eventspace?<br></blockquote><div><br>It's in the gui-eventspace (just checked with a printf and a comparison with `(eq? (current-eventspace) gui-eventspace)'), and so is the button callback.<br>
<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Robby<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, Nov 27, 2012 at 10:25 AM, Laurent <<a href="mailto:laurent.orseau@gmail.com">laurent.orseau@gmail.com</a>> wrote:<br>
><br>
><br>
> On Tue, Nov 27, 2012 at 3:58 PM, Kieron Hardy <<a href="mailto:kieron.hardy@gmail.com">kieron.hardy@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Laurent, do you have a bit of code that demonstrates your issue?<br>
><br>
><br>
> Well, it's not easy to show a minimal example, as it (seems to) depends on<br>
> 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 "Frame"]))<br>
> (define cb (new button% [parent f] [label "Menu"]<br>
> [callback (λ(cb ev)(send f popup-menu menu2 100 150))]))<br>
><br>
> ; keybindings to run commands<br>
> (add-bindings global-keymap<br>
> "C-F1" (thunk* (send f popup-menu menu2 100 100))<br>
> "C-F2" (thunk* (send f show #t)) ; to show the frame after the event loop<br>
> 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<br>
> press the button to show the popup, several times in a row, and the popup<br>
> menu does work correctly.<br>
> But if I press Ctrl-F1 to show the popup menu by attaching it directly to<br>
> the frame instead of going through the callback, not only does it not show<br>
> up, but after that pressing the button does not work anymore (actually, I<br>
> can press the button and it changes its state, so it's not frozen, but the<br>
> popup menu just does not appear).<br>
><br>
> I've tried to surround the call inside the first thunk* with a `thread' and<br>
> also with a `(parameterize ([current-eventspace (make-eventspace)])' or with<br>
> the gui-eventspace just in case, but without success.<br>
><br>
> Laurent<br>
><br>
><br>
>><br>
>><br>
>><br>
>> On Nov 27, 2012, at 4:09, Laurent <<a href="mailto:laurent.orseau@gmail.com">laurent.orseau@gmail.com</a>> wrote:<br>
>><br>
>> 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<br>
>> does not appear, and the button above does not show its own menu anymore<br>
>> either, which may mean something about eventspaces being frozen? Although I<br>
>> can still click on another button that hides the frame)<br>
>><br>
>> Any idea? I'm kind of stuck in the eventspace...<br>
>><br>
>> Laurent<br>
>><br>
>><br>
>> On Mon, Nov 26, 2012 at 4:55 PM, Laurent <<a href="mailto:laurent.orseau@gmail.com">laurent.orseau@gmail.com</a>> wrote:<br>
>>><br>
>>> There is a remaining problem: I can show frames and buttons alright, and<br>
>>> press them, but popup-menus seem to resist (although the frame I call<br>
>>> show-popup-menu on does show up).<br>
>>><br>
>>> What's strange is that they work when called from the console (in a<br>
>>> different thread, in a different namespace with eval, but with<br>
>>> namespace-anchor), but not via a keybinding (in the main thread, and in the<br>
>>> main namespace), and I could not yet reproduce this behavior in a simpler<br>
>>> setting than in the server thread...<br>
>>><br>
>>> Is there something special about popup-menus?<br>
>>><br>
>>> Laurent<br>
>>><br>
>>><br>
>>><br>
>>> On Sun, Nov 25, 2012 at 6:30 PM, Laurent <<a href="mailto:laurent.orseau@gmail.com">laurent.orseau@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> It works! Thank you very much!<br>
>>><br>
>>><br>
>><br>
>> ____________________<br>
>> Racket Users list:<br>
>> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
</div></div></blockquote></div><br></div>