How can I group and ungroup components in runtime by using a checkbox?

Hello,

I need to create an entry form with several columns of textboxes.
I need the user to be able to control the tab order left/right or up/down. I figure that by grouping a column of text boxes I can make the tab up/down and by ungrouping the boxes going left/right.
I would like to control this with a boolean variable through a checkbox or similar method.

The end behavior would be similar to the “sample entry” component that comes with the SPC module.
Do to some other requirements I cannot use the “Sample Entry” in this screen.

Does anyone knows a way to achieve this result?

Thanks

Without creating new components in runtime, you can change the tab order with scripting.

First, to disable normal traversal behavior, and gain access to tab events, the following line is used (put this on the focusGained event):

event.source.setFocusTraversalKeysEnabled(False)

put this code in the KeyPressed event of the component:

# enter the name of the next component to gain focus
nextTextField = 'Text Field 1'

# check for tab
if event.keyCode == event.VK_TAB:
	event.source.parent.getComponent(nextTextField).requestFocusInWindow()
3 Likes