SELECTED_FONT, Tab Strip Component, erratic behavior

I have a Tab Strip with 6 tabs. Each tab selects a different “Main” Window (incoming event also calls swapTo()). I have created a tabData dataset with SELECTED_FONT and UNSELECTED_FONT columns. I have bound the selectedTab to “[System]Client/User/CurrentWindow”
I believe I am following all the best practices regarding tab strips. (If not, please advise.)

The problem is inconsistent behavior with the “setting” of the font to the SELECTED_FONT value when a tab is selected.
After the first couple clicks for the next half-dozen clicks it sets the SELECTED_FONT on the tab selected three clicks ago.
Then it catches up a click and sets the SELECTED_FONT on the tab clicked just previous to the last click.
After another pass through the tabs or so, it sets the SELECTED_FONT properly - on the tab clicked.

  1. This seems like a defect - is it a known defect?

I tried hard-setting the font to the selected value with a variety of code constructs but was not able to get to the font property of the selectedTab (TabBar.Tab Strip.selectedTab.font) - has anyone done this?

  1. Are the properties of the selectedTab “reachable” via script?
    Thank you.
  1. It’s not a know defect. We’ll look into it.

  2. Yes. For example, here’s a way to change the Font of the selected tab using scripting:

from java.awt import Font

tabStripDataset = event.source.parent.getComponent('Tab Strip').tabData
selectedTab = event.source.parent.getComponent('Tab Strip').selectedTab
pyDataset = system.dataset.toPyDataSet(tabStripDataset)

i=0
for row in pyDataset:
	
	if row.__getitem__("NAME") == selectedTab:
		family = "Times New Roman" 
		size = 14 
		style = Font.PLAIN 
		font = Font(family,style,size)
		newDataset = system.dataset.setValue(tabStripDataset,i,"SELECTED_FONT",font)
		event.source.parent.getComponent('Tab Strip').tabData = newDataset
		break
	i+=1  
1 Like

Hi Samson,
Great work, nice code!
I understand what you have done, however, not exactly what I had in mind. (Sorry, not enough detail!)
I was wondering if there was a way to actually set the font on the Tab Strip.selectedTab, (not the fonts in the table), perhaps driven by an event, a la:

window = system.gui.getParentWindow(event) windowname = window.name tStrip = window.rootContainer.getComponent("Tab Strip") tDatComp = tStrip.tabData selTab = tStrip.selectedTab data = tDatComp.data for row in range(data.rowCount): nameVar = data.getValueAt(row, "NAME") selFont = data.getValueAt(row, "SELECTED_FONT") if windowname == nameVar: selTab.font=toFont(selFont)

Of course, if the selected_font of the control worked it would be unnecessary! (It is supposed to just happen - I was trying to force it)

Thank you!

I forgot to mention something. The current window means, “the window that is currently maximized” and nothing is ever maximized in the designer. So, the binding to “[System]Client/User/CurrentWindow”
won’t work in the designer, but will work on the client. Also, check out the part in the user manual that covers “common navigation strategy” for navigation best practices.