Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Controls Not Have Focus

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
US
I have a form that I wish to use for display purposes only, I have locked down the controls and set all tab stops to No.

When the form is opened, it still defaults to the first physical control for focus, is there any quick way of setting the form so that none of the controls takes focus?

I have in the past just added a tiny dummy control to take focus but wonder if there is a correct way of doing this.
Is it possible to setfocus to the 'Close' button?

I am using A97
Thanks


If IT ain’t working Binnit and Reboot
 
Ken
No, but will do now!

Where did you find that?

Binnit

If IT ain’t working Binnit and Reboot
 
Ken
Does not compile as variable 'CmdClose' not defined

I tried me.Form.CloseButton.Setfocus but that didn't work either.

Binnit

If IT ain’t working Binnit and Reboot
 
don't named your creat 'Close' button as 'CloseButton',change it's name to 'CmdClose'.
the 'CloseButton' is the system name.
 
Hi

Well since I am not a mind reader I did guess at the name of your close button (cmdClose seemed reasonable, but maybe not).

Why not true

MyCloseButton.SetFocus

where MyCloseButton is the name of your close button

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken
Seem to have misled you here... sorry

I do not have a Close control on my form at all! (I realise that I could do and then set focus to it)

What I would like to do is either
1) stop the default focus completely or
2) somehow set the focus to the form Close X in the Form Control Box

An answer to 1 would be preferred but I suspect that neither of these are possible options and I will have to revert to a tiny control or as you say a specific Close control.

Thanks and sorry for the confusion


If IT ain’t working Binnit and Reboot
 
The other way is set all controls Properties in your form and the Textbox look like a Label:
Enabled = False
Locked = True
 
A possibility that I have used before is to make a command button on the form. Give it no graphic and no action. Set its "Transparent" option to "Yes" and then give it the focus in formOpen using

Me.cmdHidden.SetFocus

where cmdHidden is the transparent command button you made


Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top