Can't disable object - has focus...

Steff_DK

Registered User.
Local time
Today, 15:55
Joined
Feb 12, 2005
Messages
110
I have a bunch of text boxes that are only enabled after clicking an "edit" button.

I want to disable them again when I click another button, "save", but I can't, since one of the objects now has focus...

Where do I "throw" the focus, so I can disable the text boxes again?
 
Presumably you are trying to disable the save button too, as it should have the focus when it gets activated (clicked on, press enter, hotkey whatever...)??

Perhaps...

me.YourEditButtonName.enable '(assuming you disabled it after enabling the fields)
me.YourEditButtonName.setfocus

HTH

Johh.
 
To be honest, it's actually a label with underlined text that says "save"....

save

To give it a html feel to it...

I have put the "disable text boxes" in the click event of the label.

Since one of the text boxes always has focus after the edit, I can't disable them as long as the cursor is placed in one of them. I have tried to set focus the the form, but no luck :mad:

Is there any way to give the access db a state where nothing has focus?
 
Hmm... neat!

But still I consider it a plan B, to insert a small hidden text box to shift the focus to - not so pretty, but it gets the job done. Of course I must remember to remove it from the tab list...
Maybe that'll be my final option...

Btw, did you think about the possibility that the user might not always have the cursor hovering above the text box, he or she is currently writing to?

To the user I think it'll be hard to guess why the text box suddenly loses focus, for no apparant reason....

I like very much the label caption changes! It gave me the idea to add a label in my entry forms where it gives the format, or an example of what should be entered, at the textbox that has the current focus. On lost focus I can set the caption to "" again.
I think it'll work better than control text tips.

Thanks! :)
 
I remember having this problem a while ago. I thought about doing the same thing you just came up with...

If I remember correctly, you can set focus to a hidden control. I may be wrong, because when I did it, the control was also not enabled that I tried to use.

I ended up just picking any reasonable control to shift focus to, such as a tab or something else of the sort.
 
That was just for an example purpose.

I always use my tbHidden text box in all my forms. I always set the focus to another object during the execution of a sub or function so that the object [command button, etc.] no longer has the focus after an object was clicked.

I rarely fire an event based on the MouseMove but again that was just to illustrate my point with my sample db.
 
NeuronRider said:
If I remember correctly, you can set focus to a hidden control. I may be wrong, because when I did it, the control was also not enabled that I tried to use.
You can not set the focus to a hidden [not visible] or non enabled object. But it can be locked when you set the focus to it.

My example tbHidden does not have the Tab Stop property set to No but it should if you use this method in your db.
 
ghudson, thanx for your help. yeah - I noticed you can't set focus to an invisible object....

No use wasting more time here - I'll go with the tbHidden approach.


I rarely fire an event based on the MouseMove but again that was just to illustrate my point with my sample db.

I should have guessed... :o Good illustration! Thanks for all your help!
 

Users who are viewing this thread

Back
Top Bottom