-
-
Save Bogdanp/e0cbeb4708234aa5feb326c7ccc8da2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/gui | |
(define (context-mixin %) | |
(class % | |
(super-new) | |
(define ctx (make-hasheq)) | |
(define/public (change-ctx) | |
(hash-set! ctx 'a 1)))) | |
(define (show-canvas) | |
(define frame | |
(new frame% | |
[label "Example"] | |
[width 800] | |
[height 600])) | |
(define canvas | |
(new (context-mixin canvas%) | |
[parent frame] | |
[paint-callback (λ (self dc) | |
(send self change-ctx))] | |
[min-width 800] | |
[min-height 600])) | |
(send frame show #t)) | |
(define frame | |
(new frame% | |
[label "Example"] | |
[width 800] | |
[height 600])) | |
(define button | |
(new button% | |
[parent frame] | |
[label "Show Canvas"] | |
[callback (λ (_self _event) | |
(show-canvas))])) | |
(send frame show #t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment