Hello Racketeers,

I am trying to create a GUI program, my problem is that the source code for 
the
GUI portion is growing out of control and I don't know how to split it up.

Here is some background info: the GUI is basically just a specialised 
frontend
to a database, the users clicks some stuff, the corresponding query is
constructed and sent off to SQLite using the db library.

The layout is to have one main window with a tab view. The application is
supposed to manage a small library, so each tab shows either the books, the
users, or the rentals. Here is a simple tree-view of the GUI:

  main window
  |
  |-- main tab view
      |
      |-- Books pane
      |   |
      |   |- List view of books (a table)
      |   |- Button to add a new book
      |   |- Button to remove a book
      |   |- Button to rent out a book
      |
      |-- Users pane
      |   |
      |   |- List view of users (a table)
      |   |- Button to add a new user
      |   |- Button to remove a user
      |
      |-- Rentals pane
          |
          |- List current rentals (a table)
          |- Button to remove a rental


I might reconsider the rentals part, but that's not relevant at the moment. 
My
problem is that even though the three panes don't need to know anything 
about
each other, they need to know about their parent (the main tab view), I 
cannot
split the code into a module hierarchy like the tree.

  (define main-window (new frame% [label "Library"]))
  (define main-tab-view (new tab-panel% [parent main-window]))

  (define books-panel (new vertical-panel% [parent main-tab-view]))
  (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]))


And so on. This isn't much code, but add in all the callbacks and events, 
and
repeat that for all the three views, and the code quickly starts adding up.
How should I break it up into smaller modules?

-- 
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