Now prompts for user name via the GUI
This commit is contained in:
parent
44a02c7025
commit
183fad9de3
@ -84,6 +84,7 @@
|
||||
(send input set-value "")
|
||||
)
|
||||
|
||||
; retrieves a message user inputed to the text field
|
||||
(define (get-message)
|
||||
(define one-message
|
||||
(if (not (null? messages))
|
||||
@ -191,13 +192,20 @@
|
||||
; specified
|
||||
(define height 15) ; height between messages drawn on the screen
|
||||
|
||||
;; prompt user for username
|
||||
;; could randomly assign a user
|
||||
(define (get-username)
|
||||
(get-text-from-user "Username set-up" "Please enter a username"
|
||||
main-frame "user" (list 'disallow-invalid)
|
||||
#:validate string? ))
|
||||
|
||||
;;dispatch goes below that
|
||||
;; TODO get username function maybe
|
||||
(define (dispatch command)
|
||||
; 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 'get-username) get-username)
|
||||
((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)
|
||||
@ -220,6 +228,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
;Initilize scrolling
|
||||
|
||||
;Then we need to find out if we need them or not.
|
||||
|
@ -48,8 +48,9 @@
|
||||
; create a gui object
|
||||
; (define hermes-gui (make-gui))
|
||||
; ((hermes-gui 'show))
|
||||
(displayln "What's your name?")
|
||||
(define username (read-line))
|
||||
;(displayln "What's your name?")
|
||||
;(define username (read-line))
|
||||
(define username ((hermes-gui 'get-username)))
|
||||
|
||||
;send the username to the server (username in out)
|
||||
(displayln username out)
|
||||
@ -95,6 +96,8 @@
|
||||
;; TODO read from GUI instead
|
||||
;(define input (read-line))
|
||||
(define input ((hermes-gui 'get-message)))
|
||||
; TODO prompt for color as well
|
||||
|
||||
; TODO /quit instead of quit
|
||||
(cond ((string=? input "quit")
|
||||
(displayln (string-append date-print username " signing out. See ya!") out)
|
||||
|
Loading…
Reference in New Issue
Block a user