bkovitz
2018-10-15 17:21:10

@mark.warren Looking at the games directory was quite useful! Thanks for suggesting that. Now I’ve finally seen “real” Racket code. I had no idea how much Racket source code was already on my hard drive.


samth
2018-10-15 17:22:53

bkovitz
2018-10-15 17:27:37

@samth Whoa, this looks great! Might be just what the doctor ordered. I learned how to make GUIs in Borland C++ from their example chess app. But theirs was a lot longer than 162 lines!


bkovitz
2018-10-15 20:23:19

racket/gui question: If you have a frame% with two canvases in it, one above the other, how can you add a widget that the user can drag to change the proportion of space given to each canvas?


bkovitz
2018-10-15 20:25:09

There seems to be a panel:splitter-mixin, but I haven’t understood how to use it. https://docs.racket-lang.org/framework/Panel.html#%28def._%28%28lib._framework%2Fmain..rkt%29._panel~3asplitter-mixin%29%29


philip.mcgrath
2018-10-15 23:29:11

@bkovitz If I understand what you want to correctly, I think you want panel:vertical-dragable% or panel:vertical-dragable-mixin: http://docs.racket-lang.org/framework/Panel.html?q=#%28def._%28%28lib._framework%2Fmain..rkt%29._panel~3avertical-dragable~25%29%29


philip.mcgrath
2018-10-15 23:31:00

(I don’t think I understand panel:splitter-mixin either.)


bkovitz
2018-10-15 23:32:50

Thanks. I was looking at those earlier today and wasn’t quite sure how to use them. I’ll have another look right now. Maybe my Racket chops have improved since then. :wink:


philip.mcgrath
2018-10-15 23:39:16

@bkovitz Here’s a little example: #lang racket/gui (require framework) (let* ([f (new frame% [label "Example"] [width 400] [height 400])] [p (new panel:vertical-dragable% [parent f])]) (define (add-child label) (new message% [label label] [parent (new group-box-panel% [label label] [alignment '(center center)] [parent p])])) (add-child "A") (add-child "B") (send f show #t))


bkovitz
2018-10-15 23:39:34

bkovitz
2018-10-15 23:40:07

Thanks! I’ll try that right now. Aha, I already see that there should be only one such panel.


bkovitz
2018-10-15 23:41:56

That was it. One tiny change did it:


bkovitz
2018-10-15 23:42:24

(That’s at the end of a frame% class definition.)


bkovitz
2018-10-15 23:43:13

Hooray!


bkovitz
2018-10-15 23:54:34

Say, in a REPL run from racket -i, how can you “cd” into a module, as if you were in DrRacket?


philip.mcgrath
2018-10-15 23:55:31

bkovitz
2018-10-15 23:57:52

Ah, it does exist! Thanks. I just tried it.


philip.mcgrath
2018-10-15 23:57:56

It’s also built into XREPL as the ,enter [<module>] [noisy?] “meta command": http://docs.racket-lang.org/xrepl/index.html?q=xrepl#%28xrepl._enter%29


bkovitz
2018-10-16 00:00:16

Excellent. It’s starting to look like working in racket -i is actually very practical.


bkovitz
2018-10-16 00:06:30

readline even works as expected. I’m used to vim’s key bindings, so this is really good.


bkovitz
2018-10-16 00:29:42

I just found the ^, ^^, etc. variables. How did I ever live without XREPL? :smile:


mark.warren
2018-10-16 06:23:41

@bkovitz No problem, glad to be of help.