diff options
-rw-r--r-- | Hermes/Hermes_Gui1.3.rkt | 26 | ||||
-rw-r--r-- | Hermes/client.rkt | 7 |
2 files changed, 26 insertions, 7 deletions
diff --git a/Hermes/Hermes_Gui1.3.rkt b/Hermes/Hermes_Gui1.3.rkt index 67597e4..909c51b 100644 --- a/Hermes/Hermes_Gui1.3.rkt +++ b/Hermes/Hermes_Gui1.3.rkt @@ -8,13 +8,15 @@ ;and the color as a string ;Object stuff +; TODO make different objects threadable send button vs text area vs canvas +; TODO gui is just a relay remember (provide make-gui) (define (make-gui) ;;Create the frame/window with title "Example5", width 500 and height 700 (define main-frame (new frame% - [label "Example5"] + [label "Hermes"] [width 500] [height 700] )) @@ -147,6 +149,12 @@ (update-helper (cdr given-list)))))) ;;Variables go below functions + ; for interfacing with outside elements + (define gui-input-in-s '()) + (define gui-input-out-s '()) + (define gui-input-in '()) + (define gui-input-out '()) + (define name "Me") (define min-h-size 80) (define min-v-size 30) @@ -157,16 +165,22 @@ (define height 15) ; height between messages drawn on the screen ;;dispatch goes below that + ;; TODO get username function maybe (define (dispatch command) - (cond ((eq? command 'show) (send main-frame show #t)) - ((eq? command 'send) send-message) + ; show gui should return the users the name as well as its first message + ; to be called + (cond ((eq? command 'show) (lambda () (send main-frame show #t))) + ((eq? command 'gui-input-port)) + ((eq? command 'send) send-message) ;; call to show a message in a gui ((eq? command 'set-name) (lambda (newname) (if (string? newname) (set! name newname) (print "Thats not good")))) - ((eq? command 'recieve-message) user-message) - ((eq? command 'get-list) listy) - ((eq? command 'set-list) update) + ; ((eq? command 'recieve-message) user-message) + ; ((eq? command 'get-list) listy) + ; ((eq? command 'set-list) update) ;;Something up with that + ; else should assume a message and output to screen we do not want it + ; to fail (else (error "Invalid Request" command)) )) ;;dispatch goes below that diff --git a/Hermes/client.rkt b/Hermes/client.rkt index 91c22de..f4cf137 100644 --- a/Hermes/client.rkt +++ b/Hermes/client.rkt @@ -11,6 +11,10 @@ ; we will prompt for these in the gui +(define hermes-gui (make-gui)) ;; our gui +((hermes-gui 'show)) + + (define host3 "localhost") (define port-num 4321) (define sleep-t 0.1) @@ -104,7 +108,8 @@ ;(exit) ] [(string? evt) - (displayln-safe evt convs-out-s convs-out)] ; could time stamp here or to send message + (displayln-safe evt convs-out-s convs-out) + ((hermes-gui 'send) evt "black")] ; could time stamp here or to send message [else (displayln-safe (string-append "Nothing received from server for 2 minutes.") convs-out-s convs-out)])) |