[racket-dev] platform dependence with tab-panel callback
I've fixed the Gtk and Cocoa bindings to never invoke a `tab-panel%'
callback when the tab changes indirectly via the `set', `append', or
`delete' method.
It's possible that you were hoping to have the callback invoked more
often on Windows, instead of less often on Gtk, but `racket/gui' is
meant to invoke callbacks only in response to user actions.
Thanks for the report!
At Mon, 05 Mar 2012 16:10:06 +0100, Marijn wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> if you create a tab-panel with a callback, then on GNU/Linux the
> callback is called once by the system, but on Windows 7 it isn't. This
> can result in different initial tab visibility. For example:
>
>
> #lang racket/gui
>
> (define root
> (new frame% (width 300) (height 300)
> (label "Test tabs")))
>
> (define (tab-callback tab-panel event)
> (send tab-panel change-children
> (lambda (children)
> (list
> (vector-ref tab-vector
> (send tab-panel
> get-selection))))))
>
> (define tab-panel
> (new tab-panel% (parent root)
> (callback (lambda (tab-panel event)
> (displayln "called!")
> (tab-callback tab-panel event)))
> (choices '())))
>
> (define tab1
> (new panel% (parent tab-panel)
> (style '(deleted)))) ; <===
>
> (define tab2
> (new panel% (parent tab-panel)
> (style '(deleted))))
>
> (define msg1
> (new message% (parent tab1)
> (label "visible?")))
>
> (define tabs
> `((,tab1 . "t1")
> (,tab2 . "t2")))
>
> (define tab-names (map cdr tabs))
> (define tab-vector (list->vector (map car tabs)))
>
> (send tab-panel set tab-names)
>
> (send root show #t)
>
>
> The difference in this example is caused by all tabs being initially
> deleted and the callback always enabling one tab. Arguably this is not
> a valid configuration (I don't know), but there are other ways to
> tickle this difference that don't rely on that: any effectful callback
> would exhibit the difference. Is it possible to remove this
> platform-dependent difference?
>
> Marijn
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.18 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk9U104ACgkQp/VmCx0OL2wNlgCeKYg8aGBi0182hcZI0415tqfT
> BHEAnR7h+hNlPBXpZYbaKjTuDgkgpu96
> =7rnA
> -----END PGP SIGNATURE-----
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/dev