Pop up text when hover on subform

jaryszek

Registered User.
Local time
Today, 03:03
Joined
Aug 25, 2016
Messages
756
Hi,

it is possible to have pop up text when user moves mouse's cursor on subform?

Best,
Jacek
 
have you tried the TOOLTIP TEXT property?
 
Hi Ranman256,

this is working only to form controls, not form as general object.

Best,
Jacek
 
not from the subform control but you could perhaps from the section - basically identify the 'hole' where the subform is and include a small margin

perhaps something like this on the relevant section (detail/header/footer) mousemove event (not tested and probably needs more work)

Code:
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    if x>=me.subform.left-60 and x<=me.subform.left+me.subform.width +60 and y>=me.subform.top-60 and y<=me.subform.top+me.subform.height+60 then
        msgbox "Howdy"
    end if
End Sub
 
Hi Cj_London.

Not working.
I added code to detail section on main form where i have a lot of subforms.

Maybe there is a way to read what you have under cursor.

Best,
Jacek
 
worked for me.

the section mousemove event won't trigger when mouse is over a control. If you have lots of subforms and not much section whitespace and move the mouse too quickly then perhaps it won't trigger.

only other alternative would be to have some code on the mouse move events on controls on your subform, tho not sure if that would work for a datasheet. In which case you might as well use controltip text

If your subform controls have labels, you could use the controltip text there
 
Last edited:
It is working when you know exactly which subform you have.
I have a lot of them.

I thought to add for each form on dblclick event and show msgboxes with form name.
But this is not complex solution.

Best,
Jacek
 
It is working when you know exactly which subform you have
you know because you know the top, left of each subform control, so can work it out from that. Code becomes more complex to determine that - loop through the controls, check for left within 60 of X and if a match, check top against Y.

or create an array or dictionary of the relevant controls when the form is opened.
 
Hmm i have error like in attachment.

So Subform property of Me is not working...

Best,
Jacek
 

Attachments

  • Screenshot_5.png
    Screenshot_5.png
    83.2 KB · Views: 129
of course it won't I have no idea what your controls are called, change it to the name of your subform control
 
CJ_London thank you. aaa ok.

So i have to check all forms within dictionary for example.

So one by one in a loop and check it is specific form under coursor?

Best,
Jacek
 
So one by one in a loop and check it is specific form under coursor?
specific subform control, not form. However no idea it will work as you require so before spending time, get the principle working as you require first
 
Hi

I don't use control tip text as:
a) it doesn't fire unless the control is 'at the top'
b) there is a slight delay before it triggers
c) its not that obvious anyway

However it can be done quite easily using a label on the main form whose caption is updated by mouse move events.
Attached is a form & datasheet subform with mouse move events on all parts of the form & subform.
The main form includes a label in large magenta text which shows the required information

It isn't necessary to know the position of each control for this to work.
In the screenshot the mouse is over the Address line field in the subform

attachment.php


IMPORTANT:
1. Add a mouse move event to the detail section of the main form to hide the label & its caption. If necessary do the same on the form header/footer
2. Do NOT use this idea if your form includes a timer event otherwise you may get very irritating flashing and issues with controlling the mouse

NOTE:
The main purpose of this example was originally to hide/show the subform and adjust the form height / control position at the click of a button
 

Attachments

Last edited:
hi Ridders,

o thank you, very good idea and this is working like a charm!
Best Wishes,
Jacek
 
Hi,

one problem with this mouse move event.
I have all the time flashing coursor, changing from arrow to circle (macro is running) and once again to arrow.

How to turn this off?

Best,
Jacek
 
how about changing this code where it appears from

Code:
Me.lblInfo.Visible = True
Me.lblInfo.Caption = "Postcode"
to

Code:
if Me.lblInfo.Caption <> "Postcode" then
    Me.lblInfo.Visible = True
    Me.lblInfo.Caption = "Postcode"
end if

which will prevent lblInfo being refreshed unnecessarily
 

Users who are viewing this thread

Back
Top Bottom