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

LostFocus event not working on a sub form

Status
Not open for further replies.

EckyThump

MIS
May 15, 2007
33
0
0
GB
I have a lable that appears on a form when the user moves over a button.
when the focus is moved off the button to another button the lostfocus event should turn the labels visibility off.
This works fine when testing the form, but when is is opened within the main form it does not hide.
Any ideas what is going on here?
The code is on the buttons LostFocus event:
Me.lblList.Visible = False
 
Sounds like the default property for the label should be .visible = false. Then try making it visible when needed (and invisible).

I wondered why the baseball was getting bigger.
Then it hit me.
 
Yes its Visible property is set to visible so the MouseOver event sets the Visible property to true. Then when the focus is moved to another button THAT buttons lable will become visible and the label for the previous button will hide (visible = false).
My problem is that these buttons are on a form which is loaded into a subform control. When I test the form on its own it seems to work, but when the main application is running the lostfocus event doesnt seem to work and the lables remain visible when the focus moves to another button, giving the appearance of text on top of text.
 
How are ya EckyThump . . .

The [blue]On Mouse Move[/blue] event doesn't set focus to the control, so lost focus won't work.

Us the [blue]On Mouse Move[/blue] event of adjacent controls to hide the label!

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Thanks TheAceMan1.
Thhats what I have done to get round this problem.
Lucily there is only four controls to hide.
I can imagine that it would become pretty unwieldy if there were alot of controls to hide, I dont know if a procedure would be worth exploring where the OnMouseMove could reference a procedure to turn the visibility of the other required controls to False and show only control that the MouseMove event is triggered. Is that possible?
 
Also . . . this kind of on/off control of textboxes is never pleasing to eye and corrupts the minds of non-savvy users! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top