Created
August 11, 2020 02:38
-
-
Save zamora/1cfc6480f7703735dffa3169facfbf10 to your computer and use it in GitHub Desktop.
Chat U/I in Racket
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 | |
; Main Window | |
(define frame (new frame% [label "FooChat Deluxe"] | |
[width 800] | |
[height 300])) | |
; Menu Bar | |
(define menubar (new menu-bar% [parent frame])) | |
(define file-menu (new menu% [parent menubar] [label "File"])) | |
(define file-save (new menu-item% [parent file-menu] [label "Save..."] | |
[callback (lambda (sender event) #t)])) | |
(define blah-menu (new menu% [parent menubar] [label "Blah"])) | |
(define blah-item (new menu-item% [parent blah-menu] [label "About"] | |
[callback (lambda (sender event) #t)])) | |
; Messages | |
(define message-panel (new horizontal-panel% [parent frame])) | |
(define message-area (new vertical-panel% [parent message-panel][alignment '(left top)] [style '(border)])) | |
(define m1p (new horizontal-panel% [parent message-area] [alignment '(left top)] [style '(border)])) | |
(define m1u (new message% [parent m1p] [label "alice"] [min-width 80])) | |
(define m1t (new message% [parent m1p] [label "It's snowing outside!!"])) | |
(define m2p (new horizontal-panel% [parent message-area] [alignment '(left top)] [style '(border)])) | |
(define m2u (new message% [parent m2p] [label "bob"] [min-width 80])) | |
(define m2t (new message% [parent m2p] [label "In August????"])) | |
(define m3p (new horizontal-panel% [parent message-area] [alignment '(left top)] [style '(border)])) | |
(define m3u (new message% [parent m3p] [label "alice"] [min-width 80])) | |
(define m3t (new message% [parent m3p] [label "Nevermind, the snow is a representation of collective anxiety about the world "])) | |
; User list | |
(define userlist (new vertical-panel% [parent message-panel] [alignment '(right top)] [style '(border)])) | |
(define alice (new message% [parent userlist] [label "alice"])) | |
(define bob (new message% [parent userlist] [label "bob"])) | |
(define carol (new message% [parent userlist] [label "carol"])) | |
; Send Panel | |
(define send-panel (new horizontal-panel% [parent frame] [style '(border)])) | |
(define send-text (new text-field% [parent send-panel] [label ""] [min-width 500] | |
[callback (lambda(sender event) #t)])) | |
(define send-button (new button% [parent send-panel] [label "Send"] | |
[callback (lambda(sender event) #t)])) | |
; Display the UI | |
(send frame show #t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment