MSFLEXGRID easy question VB6

console receives an update to the grid Form1.DisplayGrid.Row = Z and Form1.DisplayGrid.Col = 0 move the users selected row from the one they were on.  Can't have that!  any way to make the code below without disturbing the users selected row?
don't really want to change it then put it back either as updates are frequent    



The code:

If ModeInUpdate = "Stopped" Then
    With Form1.Picture3
     .Width = Form1.DisplayGrid.ColWidth(1)
     .Height = Form1.DisplayGrid.RowHeight(Z) + 330
     .Cls
     .AutoRedraw = True
     Form1.DisplayGrid.Row = Z
     Form1.DisplayGrid.Col = 0
     .BackColor = Form1.DisplayGrid.BackColor
     .FontSize = Form1.DisplayGrid.CellFontSize
     .FontName = Form1.DisplayGrid.CellFontName
     Form1.Picture3.Line (10, .ScaleHeight - 2)-(.TextWidth(Left(Form1.DisplayGrid.TextMatrix(Z, 1), 1)), .ScaleHeight), vbBlack, BF
     Set Form1.DisplayGrid.CellPicture = Form1.Picture3.Image
    End With
End If
LVL 1
bluedragon99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bluedragon99Author Commented:
what it comes down to is how the hell do you set cellpicture WITHOUT setting .row first.  theres got to be a way to write to it without change the cursor position first...
0
bluedragon99Author Commented:
funny to watch the hosts updating the focus on the rows is jumping cause of the stupid .row on the set image
0
bluedragon99Author Commented:
another flexgrid for the icons and make it blend in on the right side of the host??
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mugman21Commented:
BlueDragon99,

I don't have the time to test this, but I believe it might work, Try it out and tell me if it works for future reference.....
My idea is to lock the window and not allow repaints while your updating the grid, thus keeping the selected record from changing. Let me emphasize, I'm not 100% sure it will work, but if it does it's an easy solution.


Declare the api LockWindowUpdate as:

Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long

In the code snippet you posted above, before you update the FlexGrid, call the api and pass it the flexgrid's hwnd like:

LockWindowUpdate Form1.DisplayGrid.hwnd

///// EXECUTE YOUR CODE AND THEN UNLOCK THE WINDOW BY RELEASING THE HANDLE ///////

LockWindowUpdate False

Mugman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bluedragon99Author Commented:
probably would work but the console recieves several updates a second and would be constantly locked
0
mugman21Commented:
I've used this with a listview control before to lock the window and prevent a flicker durring download updates..... The listview was receiving dozens of updates every second, there was no preformance hit, and the listview functioned as usual. It fixed the problem, I don't see any other way to fix this problem. I hope you would try this before discounting it.

0
bluedragon99Author Commented:
Yeah I've used it for the listview flicker in the past.  Ill try it when I get to work.  I think when the window is unlocked the selected cell will be changed from the .row being changed
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.