Re: [racket-users] interactive window in slideshow

2016-03-28 Thread Byron Davies
Thanks for looking into it.  No great hurry.

For now,  I just tell the kindergartners to click twice the first time around, 
but  it will be a lot clearer once the  fix happens.

> On Mar 28, 2016, at 4:34 PM, Matthew Flatt  wrote:
> 
> At Mon, 28 Mar 2016 11:53:38 -0700, Byron Davies wrote:
>> I have a single interactive pasteboard on a slideshow slide.  For a learning 
>> task, the user needs to click on objects on the pasteboard.  There’s a 
>> little 
>> glitch, however.  The user must first click on the pasteboard to make it the 
>> focus, and then click on the objects.  Is there a way to make the pasteboard 
>> become the focus when the mouse moves into it?
> 
> You should be able to use the `focus` method on the canvas after its
> frame is shown (via `on-superwindow-show`) or when a mouse event is
> received (via `on-event`). See below for an example.
> 
> But I see that `focus` doesn't work right for a canvas in a floating
> frame, like the one used by `interactive`, so the example below doesn't
> work with the current release or snapshot. I've pushed a repair to
> `focus` for the next snapshot build. I don't have a workaround for the
> current version, but I might be able to find one if that's needed.
> 
> 
> 
> #lang slideshow
> (require racket/gui/base)
> 
> (define (make-pasteboard f)
>  (define c%
>(class editor-canvas%
>  (super-new)
>  (inherit focus)
>  (define/override (on-superwindow-show on?)
>(when on?
>  (focus))
>(super on-superwindow-show on?
>  (define pb (new pasteboard%))
>  (send pb insert-box) ; to demonstrate focus
>  (new c% [parent f] [editor pb])
>  void)
> 
> (slide)
> 
> (slide
> #:title "Example"
> (interactive (blank 500 500)
>  make-pasteboard))
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] interactive window in slideshow

2016-03-28 Thread Matthew Flatt
At Mon, 28 Mar 2016 11:53:38 -0700, Byron Davies wrote:
> I have a single interactive pasteboard on a slideshow slide.  For a learning 
> task, the user needs to click on objects on the pasteboard.  There’s a little 
> glitch, however.  The user must first click on the pasteboard to make it the 
> focus, and then click on the objects.  Is there a way to make the pasteboard 
> become the focus when the mouse moves into it?

You should be able to use the `focus` method on the canvas after its
frame is shown (via `on-superwindow-show`) or when a mouse event is
received (via `on-event`). See below for an example.

But I see that `focus` doesn't work right for a canvas in a floating
frame, like the one used by `interactive`, so the example below doesn't
work with the current release or snapshot. I've pushed a repair to
`focus` for the next snapshot build. I don't have a workaround for the
current version, but I might be able to find one if that's needed.



#lang slideshow
(require racket/gui/base)

(define (make-pasteboard f)
  (define c%
(class editor-canvas%
  (super-new)
  (inherit focus)
  (define/override (on-superwindow-show on?)
(when on?
  (focus))
(super on-superwindow-show on?
  (define pb (new pasteboard%))
  (send pb insert-box) ; to demonstrate focus
  (new c% [parent f] [editor pb])
  void)

(slide)

(slide
 #:title "Example"
 (interactive (blank 500 500)
  make-pasteboard))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Calling a procedure from mysql

2016-03-28 Thread Ty Coghlan
On Monday, March 28, 2016 at 3:58:14 PM UTC-4, Ryan Culpepper wrote:
> On 03/24/2016 06:17 PM, Ty Coghlan wrote:
> > I have the following simple code:
> >
> > (require db)
> >
> > (define mdb (mysql-connect #:user user #:password password))
> > (query-exec mdb "use starwarsfinal")
> > (query mdb "CALL track_character(?)" "Chewbacca")
> > (disconnect mdb).
> >
> > Where track_character is a procedure that simply returns a simple
> > select statement. The query call to "Call track_character" fails with
> > the error "query: PROCEDURE starwarsfinal.track_character can't
> > return a result set in the given context SQLSTATE: 0A000", yet when I
> > run the select statement that the procedure runs as its own query, it
> > behaves as expected. I've noticed that this same error happens when
> > trying to call any procedure from mysql (functions work fine).
> > Looking this error up led me to find that it seems to be caused by
> > version errors, yet I have the most recent versions of both mysql and
> > racket. Any tips on how to figure this out?
> 
> The db library currently doesn't support MySQL CALL statements. You're 
> getting that error because the db library doesn't set the "can handle 
> multiple resultsets" flag when it connects to the server.
> 
> I can probably add support for CALL statements that return at most one 
> resultset pretty easily. I'll try to do that soon.
> 
> Adding support for multi-resultset CALL statements would be trickier; it 
> would require adding a new kind of structure that query can return, or 
> cramming multiple resultsets into the existing structures.
> 
> Ryan

That would fix the problems I was facing, thank you!
I may not have the best understanding of multi-sets, but couldn't a suitable 
value to return be either a racket set or a racket list of the structs that 
already represent a returned table?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Calling a procedure from mysql

2016-03-28 Thread Ryan Culpepper

On 03/24/2016 06:17 PM, Ty Coghlan wrote:

I have the following simple code:

(require db)

(define mdb (mysql-connect #:user user #:password password))
(query-exec mdb "use starwarsfinal")
(query mdb "CALL track_character(?)" "Chewbacca")
(disconnect mdb).

Where track_character is a procedure that simply returns a simple
select statement. The query call to "Call track_character" fails with
the error "query: PROCEDURE starwarsfinal.track_character can't
return a result set in the given context SQLSTATE: 0A000", yet when I
run the select statement that the procedure runs as its own query, it
behaves as expected. I've noticed that this same error happens when
trying to call any procedure from mysql (functions work fine).
Looking this error up led me to find that it seems to be caused by
version errors, yet I have the most recent versions of both mysql and
racket. Any tips on how to figure this out?


The db library currently doesn't support MySQL CALL statements. You're 
getting that error because the db library doesn't set the "can handle 
multiple resultsets" flag when it connects to the server.


I can probably add support for CALL statements that return at most one 
resultset pretty easily. I'll try to do that soon.


Adding support for multi-resultset CALL statements would be trickier; it 
would require adding a new kind of structure that query can return, or 
cramming multiple resultsets into the existing structures.


Ryan

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] interactive window in slideshow

2016-03-28 Thread Byron Davies
I have a single interactive pasteboard on a slideshow slide.  For a learning 
task, the user needs to click on objects on the pasteboard.  There’s a little 
glitch, however.  The user must first click on the pasteboard to make it the 
focus, and then click on the objects.  Is there a way to make the pasteboard 
become the focus when the mouse moves into it?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.