B
Brian
I am running into a problem with the CanFocus property not allowing me
to set the focus to a control. The application is a Form which has a
Panel and in the panel are a series of user controls. Each of the user
controls consist of a label and a combobox or text box which is
determined at runtime.
When the application starts, the focus should be set to the first
combobox or text box in the panel. What happens is that the appliation
will start, but the focus will be somewhere else until the user hits
the tab key. At that point, the focus will go to the first entry
control in the panel like it should.
I have gone through the documentation, and found a number of conditions
that must be true in order for a control to get the focus. I have
created a debug log to check these conditions and I get:
MySetFocus(company)
selectable = True
contained = True
Parent Visible & Enabled = True
Visible & Enabled = True
canFocus = False
Handle = 7145084
TabIndex = 0
TabStop = True
set focus = False
entry control set focus = False
entry panel contains focus = False
Other messages in this group and others have suggested that I set
TabIndex to 0 and use the ActiveControl property. Neither of these
have worked. Actually as Panel does not have ActiveControl, I set the
panel to be the active control in the Form and that did not work either.
to set the focus to a control. The application is a Form which has a
Panel and in the panel are a series of user controls. Each of the user
controls consist of a label and a combobox or text box which is
determined at runtime.
When the application starts, the focus should be set to the first
combobox or text box in the panel. What happens is that the appliation
will start, but the focus will be somewhere else until the user hits
the tab key. At that point, the focus will go to the first entry
control in the panel like it should.
I have gone through the documentation, and found a number of conditions
that must be true in order for a control to get the focus. I have
created a debug log to check these conditions and I get:
MySetFocus(company)
selectable = True
contained = True
Parent Visible & Enabled = True
Visible & Enabled = True
canFocus = False
Handle = 7145084
TabIndex = 0
TabStop = True
set focus = False
entry control set focus = False
entry panel contains focus = False
Other messages in this group and others have suggested that I set
TabIndex to 0 and use the ActiveControl property. Neither of these
have worked. Actually as Panel does not have ActiveControl, I set the
panel to be the active control in the Form and that did not work either.