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!

Stop the Flickering 1

Status
Not open for further replies.

sebell

Programmer
Oct 16, 2002
51
US
Hello,
I have code on labels that when moused over one lable it opens up another subset of lables to choose from. In addition, it changes the font from blue to yellow when moused over and makes sure that every other label remains blue. The problem is that there is an abundance of flickering going on that I don't know how to stop. It is out of control.
Here is example of code from one of the 5 side menu lables (keep in mind that each of these opens up a subset of labels which can be anywhere from 1 to 7 lables to the side of it.)


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

'Change forecolors of lables
Me.lblHandheld.ForeColor = 16777164 'blue
Me.lblMenu.ForeColor = 65535 'yellow
Me.lblDBAdmin.ForeColor = 16777164
Me.lblReports.ForeColor = 16777164
Me.lblComments.ForeColor = 16777164
Me.lblEquipmentChanges.ForeColor = 16777164
Me.lblLocationChanges.ForeColor = 16777164
Me.lblResolveOutstandingComments.ForeColor = 16777164
Me.lblReviewOpenWork.ForeColor = 16777164
Me.lblWorkOrderChanges.ForeColor = 16777164
Me.lblGeneratePMs.ForeColor = 16777164
Me.lblExitDatabase.ForeColor = 16777164

'Hide label options for handheld
Me.BoxHandhelds.Visible = False
Me.lblReviewHandheldData.Visible = False
Me.lblUploadFromHandheld.Visible = False
Me.lblDownloadtoHandheld.Visible = False
Me.LineHandheld.Visible = False

'Unhide label options for Main Menu
Me.BoxMainMenu.Visible = True
Me.lblComments.Visible = True
Me.lblEquipmentChanges.Visible = True
Me.lblLocationChanges.Visible = True
Me.lblResolveOutstandingComments.Visible = True
Me.lblReviewOpenWork.Visible = True
Me.lblWorkOrderChanges.Visible = True
Me.lblGeneratePMs.Visible = True
Me.LineMainmenu.Visible = True

'Hide label options for DB Admin
Me.BoxDBAdmin.Visible = False
Me.lblActionRegister.Visible = False
Me.lblEmployees.Visible = False
Me.lblESHInstructions.Visible = False
Me.LineDBAdmin.Visible = False


'Hide label options for Reports
Me.LineReports.Visible = False
Me.BoxReports.Visible = False
Me.lblSummaryReports.Visible = False

Thank you in advance for any assistance you may offer me on this,
Sherry
 
I imagine that part of the flickering may be due to the fact that you are always setting the color, regardless of whether it is already the color you want or not.

If you MUST use labels this way, perhaps consider testing for the color with an if statement:

if Me.lblHandheld.ForeColor <> 16777164 Then Me.lblHandheld.ForeColor = 16777164 'blue

... etc.

This may alleviate some of the flickering.

-Gary
 
I fixed this problem by adding an If statement to each label. E.g

If Me.LabelName.FontUnderLine = True Then
me.LabelName.FontUnderlin = False
End If

This stopped the flickering as the code only executes if the If statement is true.

Unfortunately, more coding required.

I haven't failed, I have just found 10,000 ways that it won't work!
 
Else you might consider using

[tt]application.echo false[/tt]

at the top, and

[tt]application.echo true[/tt]

at the bottom - but be warned - should an error occur prior to executing the "on" statement, your app will appear as "not responding" - put in an errorhandler and drop in an/the echo true in the exit part, too;-)

Roy-Vidar
 
Worked great. Thank you. It is a lot of code, but at least the page is going to look better. Thank you both for your help.
Sherry
 
Your welcome - anytime

I haven't failed, I have just found 10,000 ways that it won't work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top