text-field and send-button display on the same line

This commit is contained in:
Ibrahim Mkusa 2017-04-23 16:27:41 -04:00
parent 1c60a61d82
commit 9b31f3b324

View File

@ -25,6 +25,8 @@
[label "Hermes"] [label "Hermes"]
[width 500] [width 500]
[height 700] [height 700]
[min-width 500]
[min-height 700]
)) ))
;;Editing canvas ;;Editing canvas
(define (do-stuff-paint paint-canvas paint-dc) (define (do-stuff-paint paint-canvas paint-dc)
@ -47,6 +49,8 @@
[parent main-frame] [parent main-frame]
[paint-callback do-stuff-paint] [paint-callback do-stuff-paint]
[style '(hscroll vscroll)] [style '(hscroll vscroll)]
[min-width 450]
[min-height 690]
)) ))
; "send" is rackets way of doing object-oriented programming. It calls an ; "send" is rackets way of doing object-oriented programming. It calls an
@ -59,13 +63,20 @@
(button-do-stuff 'irrelevant 'not-used) (button-do-stuff 'irrelevant 'not-used)
'())) '()))
; Create a horizontal panel to house the send button and text-field
(define hpanel (new horizontal-panel%
[parent main-frame]
[min-width 450]
[min-height 10]
[alignment (list 'left 'center)]))
; creates the editing area as part of the parent "main-frame" define above. ; creates the editing area as part of the parent "main-frame" define above.
; initially labelled "Username:" ; initially labelled "Username:"
; NOTE: we pad label with additional spaces so we don't have to recompute ; NOTE: we pad label with additional spaces so we don't have to recompute
; the window dimensions to fit the new label (the actual username) ; the window dimensions to fit the new label (the actual username)
; TODO make label setable ; TODO make label setable
(define input (new text-field% (define input (new text-field%
[parent main-frame] [parent hpanel]
[label "username "] [label "username "]
[callback text-field-callback] [callback text-field-callback]
)) ))
@ -111,7 +122,7 @@
one-message))) one-message)))
; creates the send button ; creates the send button
(define send-button (new button% (define send-button (new button%
[parent main-frame] [parent hpanel]
[label "Send"] [label "Send"]
[callback button-do-stuff])) [callback button-do-stuff]))
@ -321,4 +332,6 @@
(substring given-string 7)) (substring given-string 7))
;(define thing1 (make-gui)) ;(define thing1 (make-gui))
;(define thing2 (make-gui)) ;(define thing2 (make-gui))
(define hermes-gui (make-gui))
((hermes-gui 'show))