If you modify your sample code like this,
#lang racket/gui
(require framework)
(define ext-frame%
(frame:standard-menus-mixin
(frame:status-line-mixin frame:basic%)))
(define shc-frame%
(class ext-frame%
(super-new)
(define/override (edit-menu:create-clear?) #f)
(define/override (edit-menu:between-select-all-and-find _)
(super edit-menu:between-select-all-and-find 10)
(new menu-item%
[parent (list-ref (send (send this get-menu-bar) get-items) 1)]
[label "Patch"]
[callback (lambda (menu event)
(send this show #t))])))) ; The callback is just a
placeholder for now.
(define test-frame (new shc-frame%
[label "TEST!"]
[height 200]
[width 200]))
you find out that (1) the method really takes one argument and (2) that it
expects a menu:
> expected: (or/c (is-a?/c menu%) (is-a?/c popup-menu%))
> given: 10
What this means is that someone added contracts to the method as it was
implemented
and that the docs are wrong.
-- Matthias
On Apr 22, 2016, at 8:46 AM, Bruce Steinberg <[email protected]> wrote:
> I'm having trouble with overriding one of framework's methods to add a menu
> item. Here's what I'm currently doing:
>
> #lang racket/gui
>
> (require framework)
>
> (define ext-frame%
> (frame:standard-menus-mixin
> (frame:status-line-mixin frame:basic%)))
>
> (define shc-frame%
> (class ext-frame%
> (super-new)
> (define/override (edit-menu:create-clear?) #f)
> (define/override (edit-menu:between-select-all-and-find)
> (new menu-item%
> [parent (list-ref (send (send this get-menu-bar) get-items) 1)]
> [label "Patch"]
> [callback (lambda (menu event)
> (send this show #t))])))) ; The callback is just a
> placeholder for now.
>
> (define test-frame (new shc-frame%
> [label "TEST!"]
> [height 200]
> [width 200]))
>
> When I run the program I get the following error:
>
> edit-menu:between-select-all-and-find method in shc-frame%: arity
> mismatch;
> the expected number of arguments does not match the given number
> expected: 0
> given: 1
> arguments...:
> (object:...ork/private/menu.rkt:33:4 ...)
>
> Sorry if I'm missing something basic. I'm fairly new to programming.
>
> Thanks so much.
>
> -Bruce
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.