[racket-dev] platform dependence with tab-panel callback

From: Marijn (hkBst at gentoo.org)
Date: Mon Mar 5 10:10:06 EST 2012

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

Posted on the dev mailing list.