Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on

probably something easy, but i do not seem to find it

This is an 80 number keno game using the msflexgrid
I pulled this form from a larger project to try and control msflexgrid flickering
The wins is when most of the flickering starts and is based on the numbers in flexStatus.
But no matter what i try i cannot get flexStatus to show, so i get no wins
i have checked the following:
Visible
Zorder
height, width
top, left
The program is supposed to run 12 times, but for testing i cut the runs to 5
At the end of a run labels are rotated the amount of the win
Clicking anywhere causes the win to add up instantly if the user does not want to wait

guess i can only upload 1 file at a time will post again with the project attached
User generated imageCleopatra-Flicker.zip
Avatar of Chris Raisin
Chris Raisin
Flag of Australia image

Tricky...I am looking into it.

I think it has something to do with the width of flexStatus, which seems enormous.

Stand by

Christopher(craisin)
ASKER CERTIFIED SOLUTION
Avatar of Chris Raisin
Chris Raisin
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of isnoend2001

ASKER

thanks after more testing i have found that the flicker is so bad it is effecting the flexstatus.
i put a break on Sub Generate20Numbers and it shows. when i copied this form from the main app. the flicker was only affecting the 80 number grid not the images and flexStatus.
putting a sleep shows the flexstatus until the first run starts. then it disappears along with the image at the top
Public Sub StartBonus()
  Dim i As Integer
  For i = 1 To miMax_Runs '12 constant
   Sleep 2500
    Generate20Numbers 'run 12 times
    Next
    Unload Me
End Sub
thanks
Pasted flexstatus outside the picturebox and removed this from
Sub Generate20Numbers
took out this out the sub 2 places
 Me.Refresh
and the flexstatus stays visible
There is no such call as "LockWindowUpdate False"
The correct way to call it is "LockWindowUpdate 0"  
("False" is a boolean an not a numeric and so it may be causing problem with that call.)

So in your procedure "CheckIfWin", you need to move the LockWindow procedure outside the loop (after all you do not want to lock it 20 times!), and then unlock it after the loop is finished.

So the code there should be:

      LockWindowUpdate flexStatus.hWnd
      For i = 1 To EndRow
          If miHits >= Val(flexStatus.TextMatrix(i, 0)) Then ' check first row first
             mcurWinCurrentRun = Val(flexStatus.TextMatrix(i, 1))
             mbWinningRun = True
             DoEvents
             ReSetForColorFlexStatus 'if more than 1 win reset prev color to blue
             flexStatus.Row = i
             flexStatus.Col = 0
             flexStatus.CellForeColor = vbRed
             DoEvents
             flexStatus.Row = i
             flexStatus.Col = 1
             flexStatus.CellForeColor = vbRed 'SET THE SECOND col to red
             CheckIfWin = True
             mcurWinCurrentRun = mWinAmout
             miCreditsWon = Val(flexStatus.TextMatrix(i, 1))
          End If
      Next
      LockWindowUpdate 0 'unlocks currently locked window since 
                                          'only one window can be locked at a time

Open in new window




Are we any closer?
Thanks i will give it a go
It depends on whether "False" evaluates as 0in your code. If it does, then it should be OK, but you definately should have the "Lock" functions outside the loop (for efficiency).

Perhaps also, placing multiple locks on a window MAY (I say MAY) mean multiple "Unlock" processes are needed (although the documentation for "LockWindowUpdate" states only one lock at a time can be placed on a window (making the multiple calls within a loo ineffective but still requiring processing time).

It all seems to work on my system (although the "beep" calls are driving me crazy!) :-)
Any further problems?
no
 thanks
I'm actually enquiring whether it all works now.  :-)
Don't remember exactly, but i think
 I stopped working on it. Didn't have the problem when the form was part of the larger project. but i will keep an eye on it to see if it resurfaces
Well this question needs some closure. If you find that the question you originally asked has been solved by my interaction and advice then you need to close it and award points, otherwise it could remain in "limbo" forever.
As far as i can tell it has been closed an points awarded:

Accepted Solution

by: craisinPosted on 2014-02-15 at 05:55:59ID: 39861331
Oops! My apologies.

I missed that completely.

Thanks very much, and good luck with your project.   :-)

Cheers
Chris
Good, glad it's closed
No Problem
thanks