Hi Jeyron,

here is a simple example which shows how the callback for the menu might 
open a new window (a dialog in this case).

#lang racket/gui

(define main-window (new frame% [label "Example"] [width 100] [height 100]))

(define menu-bar (new menu-bar% [parent main-window]))

;; Callback for the "Add" menu item.  receives the menu item and the event
;; that triggered the menu
(define (on-add-volunteer menu-item event)
  (define dialog (new dialog% [label "Add Dialog"] [parent main-window]))
  (define button (new button%
                      [label "Close"]
                      [parent dialog]
                      [callback (lambda (button event)
                                  (send dialog show #f))]))
  (send dialog show #t))

(define menu-volunteers
  (new menu%
       (label "&Volunteers")
       (parent menu-bar)))
(define menu-item-add
  (new menu-item%
       (label "&Add")
       (parent menu-volunteers)
       (callback on-add-volunteer)))

(send main-window show #t)


Best Regards,
Alex.

On Friday, October 12, 2018 at 10:16:40 AM UTC+8, Jeyron A.C wrote:
>
>
> Ok I understand that part of wanting to close the windows. And the truth 
> is that I do not need to complicate myself so much.
>
> Even so I have another doubt, and it is like using the menu bar in a 
> simple and useful way.
>
> I have my code:
>
> (define menu-volunteers
> (new menu%
>      [label "& Volunteers"]
>      [parent menu-bar]))
>
>
> (define my_item_agregar_volun
>    (new menu-item%
>         [label "& Add"]
>         [parent menu-volunteers]
>         "Here goes the callback"
> ))
>
> Exactly where the callback goes, is where I have that big doubt. That has 
> to go in that section.
>
> The idea is to call a new window where you can add data, which are 
> necessary. 
>

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