MouseMove event

G

Guest

Hi,

I have a custom menu form that I have labels as choices for uses. I have
created a public routine that changes the color of the text to yellow when
the user moves the mouse over a particular label.

In order to put the label back to white font color I put a for each
statement in the Detail section MouseMove event. I'm concerned that this
fires multiple times has the user moves the mouse around the screen. Is
there a better way? Will this cause a memory problem?

Here's my for each statement

For Each ctl In Me.Controls
If ctl.ControlType = acLabel Then
If ctl.ForeColor = 10092543 Then
'ctl.Properties("BorderStyle").Value = 0
ctl.ForeColor = vbWhite
End If
End If
Next ctl

Thanks
LeAnn
 
D

Dirk Goldgar

LeAnn said:
Hi,

I have a custom menu form that I have labels as choices for uses. I
have created a public routine that changes the color of the text to
yellow when the user moves the mouse over a particular label.

In order to put the label back to white font color I put a for each
statement in the Detail section MouseMove event. I'm concerned that
this fires multiple times has the user moves the mouse around the
screen. Is there a better way? Will this cause a memory problem?

Here's my for each statement

For Each ctl In Me.Controls
If ctl.ControlType = acLabel Then
If ctl.ForeColor = 10092543 Then
'ctl.Properties("BorderStyle").Value = 0
ctl.ForeColor = vbWhite
End If
End If
Next ctl

Thanks
LeAnn

I don't know about memory problems, but I imagine you could avoid
unnecessary code execution and make things more efficient by using a
module-level flag variable. You could set this variable in the
MouseMove events of the "pseudo-buttons" (my own nickname for buttons
used this way), and then test and reset it in the Detail section's
MouseMove event:

If mblnOverControl Then

mblnOverControl = False

For Each ctl In Me.Controls
If ctl.ControlType = acLabel Then
If ctl.ForeColor = 10092543 Then
'ctl.Properties("BorderStyle").Value = 0
ctl.ForeColor = vbWhite
End If
End If
Next ctl

End If
 
G

Guest

Worked great thanks Dirk! I regret I can't check the "helpful" option to
give you credit - that option disappeared from my browser quite a long time
ago.

Perhaps you can forward this email as credit. :)
 
D

Dirk Goldgar

LeAnn said:
Worked great thanks Dirk! I regret I can't check the "helpful"
option to give you credit - that option disappeared from my browser
quite a long time ago.

I have no idea why that is. I never use the web interface, anyway -- I
use Outlook Express to read newsgroups, and it doesn't support those
hifalutin' options.
Perhaps you can forward this email as credit. :)

Your thanks is good enough for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top