Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Control msflexgrid flicker

Posted on 2014-01-20
19
Medium Priority
?
328 Views
Last Modified: 2014-01-21
I have an 80 number msflexgrid that randomly selects 20 numbers and puts a different image
selected cells
I have tried to put a small sleep to control the flicker, but it either does not help or slows the randomize too much.
cannot do a redraw false as the numbers need visually updating as they are selected.
example;
Set .CellPicture = imgHitUnSelected.Picture
What else can i try ?
0
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
19 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39794696
0
 

Author Comment

by:isnoend2001
ID: 39795603
Thanks martinliss that works good when the whole grid is updated at once,
but this grid has a speed button, where the numbers are shown as they are hit
I will try to put it before and after each number produced    
If mSpeed = 2 Then 'fastest
              Call Sleep(((1 / 3) * 1) * 10)                
            ElseIf mSpeed = 1 Then
                Call Sleep(((5 / 3) * 2) * 10)              
            ElseIf mSpeed = 0 Then
                Call Sleep(((10 / 3) * 3) * 10)              
            End If
0
 

Author Comment

by:isnoend2001
ID: 39795757
Tried this but it crashes vb for some reason
 LockWindowUpdate flexCleo.hWnd
Beep
Set .CellPicture = Me.imgHitSelected.Picture
LockWindowUpdate False

 LockWindowUpdate flexCleo.hWnd
Set .CellPicture = imgHitUnSelected.Picture
 SoundSelect = LoadResData("CLICK", "SOUND") 'v7.4
  PlaySoundData SoundSelect(0), 0, SND_MEMORY Or SND_ASYNC Or SND_NODEFAULT Or SND_LOOP
LockWindowUpdate False
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 49

Expert Comment

by:Martin Liss
ID: 39797584
When you say it "crashes vb", what do you mean exactly?

Could you attach your current workbook and tell me exactly, step by step, how to reproduce the problem?
0
 

Author Comment

by:isnoend2001
ID: 39797620
Not a workbook it's vb6. not excel
It unloads the vb6 program with a message to send to Microsoft
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39797667
OK, sorry. Could you attach a zip of your project then?
0
 

Author Comment

by:isnoend2001
ID: 39797718
that will take some doing, but i will be back
0
 

Author Comment

by:isnoend2001
ID: 39797886
martin the project is attached, but it no longer crashes don' know why
but it still flickers a little
in frmCleo
Public Sub Generate20Numbers
 LockWindowUpdate flexCleo.HWND line 1411
LockWindowUpdate False
to start the project Click bet one then mark at least 3  at least numbers
This will enable the start button to be clicked
For-EE.zip
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39797962
I did as instructed and 20 numbers turned red in fairly rapid succession. I didn't however see any flickering. Am I doing something wrong?
0
 

Author Comment

by:isnoend2001
ID: 39798261
Thanks
Don't understand why you do not see flickering, maybe try clicking the speed button >>>
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 39798326
Here is what I see. All speeds are similar. Change the filename to .mov instead of .txt.
Screen-Recorded2014-01-21-13-35-.txt
0
 

Author Closing Comment

by:isnoend2001
ID: 39798372
Thanks
Wish it looked that smooth on my pc. wonder why
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39798418
Try rebooting.
0
 

Author Comment

by:isnoend2001
ID: 39798468
Thanks had already tried that to avail.
don't both  these variables need to be true for this msg to fire ?
If mLastBallHitMarkedNumber And mWinningRun Then
 Dim msg As String
           msg = "You won a bonus"
          FadeMessage Me, picBtmMsg, msg, False ', LowerRight
End if
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39798496
What type of variables are mLastBallHitMarkedNumber and mWinningRun?
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39798506
Never mind I see that they are Booleans. Did I ever show you how to use Debug? In any case put a breakpoint on that line and when the code gets there see what the values are.
0
 

Author Comment

by:isnoend2001
ID: 39798546
yes i know how to that the idea is it has to be a win and the 20th number shown must hit
a selected number
both booleans need to be true  is this written correctly:
If mLastBallHitMarkedNumber And mWinningRun Then
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39798628
Yes it is written correctly. Here's a little code you can run to test 'And'-ing booleans.

Dim x As Boolean
Dim y As Boolean

MsgBox "Test 1: Both booleans are False"
MsgBox "Result is: " & (x And y)

MsgBox "Test 2: One boolean is True and ne is False"
x = True
MsgBox "Result is: " & (x And y)

MsgBox "Test 3: Both booleans are True"
x = True
y = True
MsgBox "Result is: " & (x And y)

Open in new window


Your If statement could also be written this way.

If mLastBallHitMarkedNumber = True And mWinningRun = True Then

Open in new window

BTW if I were naming those variables I would name them mbLastBallHitMarkedNumber and mbWinningRun. That way I would instantly know that not only are they module-level variables but also that they are Booleans.
0
 

Author Comment

by:isnoend2001
ID: 39798649
Thanks for everything MartinLiss I think i have found the boolean problem
mWinningRun was reporting true when it wasn't
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question