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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox Focus Without Cursor Entering???

Status
Not open for further replies.

AutumnBlues

Programmer
Jul 3, 2002
31
GB
Anybody know how to set the focus to a textbox without the cursor actually entering the field?

Any thoughts are much appreciated.
 
I am intrigued by the question. What exactly is it that you are trying to do? Setting the focus on a field makes that field the point of data entry, and as a consequence places the cursor there. Perhaps you should try to provide an explanation of what you wish to achieve, and we'll be better able to answer the question.
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Yeah it does sound strange.

What I'm trying to achieve is this...

A section of my table structure is three-generational - you know, a master table linked to a child table on a one-to-many, which in turn is linked to its own child on a one-to-many.

At any one time, my form looks at one record in the top (grandfather) table. Also on that form is a subform showing associated records from the middle table. Finally, there is a second subform that shows records associated with the first subform's record, when the user clicks on a record from the first subform.

I've used conditional formatting (A2K) to show which 1st subform record is the parent of the grandchild records (On Got Focus make a different colour). The only annoying thing is that there is a cursor blinking in the record, which makes an otherwise classy form look a bit naff.

I've tried all sorts of ways around it, eg setting the focus somewhere else after the click, but then the parent record loses focus and the conditional formatting is lost for that record.

So, that's the background, but I think it boils down to one thing: is it possible to set focus to a field without the cursor entering?

The best way to visualise this is to go into the QBE section of Access. You know the form from which you select the tables/queries to use - you can highlight a row with a click - that's what I want to do.

These small problems are always the most annoying. Thanks for the reply, do you think there's an answer or do I have to live with the blinking cursor?
 
Dont know if this will solve the problem, but what I sometimes do when putting the focus on a form gives the focus field undesiredhiliting, is create a very narrow (but visible) text field with a transparent border and background (which makes it appear as invisible, in a manner of speaking). Then set the tab order to make this field the first field on the form, and/or set the focus to this field on the form's oncurrent event. The effect will be to make the cursor not visible when the form is entered, but you will need then to tab or click into the next field.

This may not do exactly what you want; on the other hand it might do the trick.

There may also be options via Control Panel, or Windows api's to modify the behaviour of the cursor. Perhaps someone else can comment on that. You might even want to create another post along those specific lines.
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Thanks Steve, my own solutions are along the same lines. It would've been nice to do it simply without the workaround.

Thanks Rolliee, but that only causes an error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top