The "traditional" way of doing this in other languages and GUI toolkits is 
to
have a separate class for each of your panes (Books, Users and Rentals).  
The
constructor would receive the parent widget and other initialization
parameters (e.g. a database connection). Something like this:

    ;; books-panel.rkt
    (define books-panel%
      (class object%
        (init-field parent)

        (define books-panel (new vertical-panel% [parent parent]))
        (define books-table (new list-view% [parent books-pane]))
        (define books-buttons-pane (new horizontal-pane% [parent 
books-panel]))
        (define add-button (new button% [parent books-buttons-pane]))
        (define remove-button (new button% [parent books-buttons-pane]))
        (define rent-button (new button% [parent books-buttons-pane]))

        ;; other books panel init code and specific callbacks here

        ))
    (provide books-panel%)

    ;; main.rkt
    (require "books-panel.rkt")
    (define main-window (new frame% [label "Library"]))
    (define main-tab-view (new tab-panel% [parent main-window]))

    (define books-panel (new books-panel% [parent main-tab-view]))

I found this approach to work well in Racket.  One big advantage of doing it
like this is that you can work independently on the sub components without
having to recompile / start the entire application -- this becomes important
once your application starts to reach a non trivial size.  For example, if 
you
want to just work on the books-panel% object, you could create a simple
scratch file:

    ;; scratch.rkt
    (require "books-panel.rkt")
    (define main-window (new frame% [label "Library"]))
    (define books-panel (new books-panel% [parent main-window]))

Which would just load that component, resulting in a faster edit-compile-run
cycle.

Best Regards,
Alex.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to