I'm working on organizing and documenting some things and I have some code, below, which works but I don't understand why. Specifically, why don't I get an error about table3 not being defined?
This is a very simplified version of what I'm working on. What I actually want to do is put all the code related to creating a standard table editing menu in a file which I can then include wherever I want that menu. The full menu will be a lot of code. Unfortunately I can't seem to get this to work without either getting an error that row-edit-menu is not defined or that table3 is not defined. In other words, I want to be able to define table3 in one file which requires the file where row-edit-menu is defined but I can't seem to figure out how to get this to work. It works just fine when all the code is in one file, however. James #lang racket (require racket/gui/base qresults-list ) ;set up columns (define (column1 data) (vector-ref data 0)) (define (column2 data) (vector-ref data 1)) (define my-columns (list (qcolumn "Column1" column1 column1) (qcolumn "Column2" (lambda (row) ;(displayln row) ;(displayln (db-row-ref row "Column2" headers 1)) (if (number? (column2 row)) (number->string (column2 row)) "");This allows a cell to be blank. ;(number->string (column2 row)) ) column2) ) ) (define frame3 (new frame% [label "myTable 3"] [width 800] [height 600] )) (define row-edit-menu (new popup-menu% )) (define info-menu-item (new menu-item% (label "info") (parent row-edit-menu) (callback (lambda (menu-item event) (message-box "Info" (~a "You have selected " (length (send table3 get-selected-row-indexes)) " rows") #f) )) )) (define table3 (new (class qresults-list% (init) (super-new) [parent frame3] [pref-tag 'preferences-tag] [selection-type 'multiple] [right-click-menu row-edit-menu]) ) (send table3 setup-column-defs my-columns) (send frame3 show #t) (send table3 add-row (vector "R1C1" 10)) (send table3 add-row (vector "R2C1" 11)) (send table3 add-row (vector "R3C1" 12)) (send table3 add-row (vector "R4C1" 13)) -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/F54B34B7-F04F-4DF7-9236-FD6C4FE3C983%40biomantica.com.