SetFocus Problem

I instantiate NewWindow from DetailWindow so I can use it to create, update, delete,… several tables in a database (e.g. customers, suppliers, ZIP codes,…). On DetailWindow there is one Listbox, one Label and one Textfield. The Listbox is dynamically files with the data from the table. Labels and Textfield are dynamically (Control sets) generated based on the number of columns in the ListBox. This works well…

When making the Window visible, I want to set the focus on the first row of the ListBox (ListBox1.SetFocus) .However the focus always starts on the first Textfield. Tabbing works well and goes through all textfields and ends on the ListBox. When reaching the ListBox, tabbing is not available anymore. What’s is going wrong? How to set focus on ListBox when starting the window? How to reactivate the tabbing when the focus reaches the ListBox?

Have you made sure to set ListBox1.Tabindex to 0 ?

Michel, yes. TabIndex for the ListBox=0, TabIndex for the Textfields=1,2,3…

What OS? I have the same focus problem in a Cocoa app but it works correctly in Carbon. My ugly workaround was to start a single-shot short-period timer at the end of Open which just sets the focus.

Will, I develop the application on MAC OS X 10.7.5

Tab Order Change in Real Studio 2012r1

I created a small test project, and you are right, it goes to the textfield, although the listbox is tabindex 0.

Tried to set the focus in the open event, did not work.

What I found working is to create a boolean window called gothefocus and added this in the textfield GotFocus event :

Sub GotFocus() if gotthefocus = false then ListBox1.setfocus gotthefocus = true end if End Sub

Hope this helps.

Eli, Thank you. Do you know they already changed this in Xojo?

[quote]UPDATE: After considering feedback from the community, we have decided to rollback this change in R1. We are working on an update (R1.1) that will re-enable the ability to set the tab order once again. We have found a way to provide the default tab order along with a custom tab order option (the one you have now) which we will add to a future version[/quote].

Michel, this workaround solves the problem. But, is this (still) a bug in Xojo?

Looks like a bug. I encountered it before.

Filed a report # 32520