#2854 Set Tab selected

Wolf K. Sat 28 Aug 2021

If I have a TabPane with more than one Tab, how can I set a tab selected? I just couldn't find out.

SlimerDude Sat 28 Aug 2021

Hi Wolf K.,

It looks like TabPane.selected is a field (and not a method) so you should just be able to set the selected tab there.

Does something like this work?

tabPane := ...
tab     := tabPane.tabs[2]  // grab the 3rd tab
tabPane.selected = tab

Wolf K. Sat 28 Aug 2021

Tried it, but doesnt't seem to work.

I also thought of sending a click event to the tab in question, but dont know how to do it either.

Wolf K. Sun 29 Aug 2021

Hi SlimerDude,

I think I was doing things in the wrong order. Now found a solution that works for me. In my case I want a certain tab (not the first) to be selected when the window is opened.

Including your code in the onOpen event does the trick.

Thank you very much for your help.

Login or Signup to reply.