Tab font in a tab-panel% doesn't want to change

Here is the situation:

I am trying to make an application in Racket that will be used with a touchscreen.
Naturally, I wanted to make lists, multi-selects, tabs, etc. a larger size, so that they can be more easily seen and clicked/tapped.
I wasn't sure how to do this, as there is no scaling/zoom arguments for list-boxes and tab-panels, at least none that I could see in the docs.
So figured using a larger font size = larger list-box rows & tab buttons.
It worked fine for a list-box%, but on a tab-panel, the font argument doesn't seem to do anything.

Below is some code that demonstrates the problem.

I am using Racket v8.7 & Windows 10.

#lang racket/gui

(define large-font (make-font
                   #:size 20
                   #:family 'default
                   ))

(define main-frame (new frame% [label "Test"]
                        ))

(define panel (new panel% [parent main-frame]
                   [min-height 150]
                   [min-width 200]
                   ))

(define tab-panel (new tab-panel%
                       [parent panel]
                       [font large-font]
                       [choices (list "Tab 0"
                                      "Tab 1"
                                      "Tab 2")]))

(define label (new message%
                   [parent tab-panel]
                   [font large-font]
                   [label "Tab font should be like this"]))

(send main-frame show #t)

image

I create a larger font size and assign it to the tab-panel. But it doesn't seem to have any effect on the tab-panel%! Could someone please explain why this doesn't work, and how to get the effect I want?

1 Like

Try adding the flat-portable and no-border styles when constructing the tab panel:

(define tab-panel (new tab-panel%
                       [parent panel]
                       [font large-font]
                       [style '(flat-portable no-border)]
                       [choices (list "Tab 0"
                                      "Tab 1"
                                      "Tab 2")]))

Alex.

2 Likes