?
Solved

MSFLEXGRID easy question VB6

Posted on 2004-11-10
10
Medium Priority
?
464 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:bluedragon99
  • 5
  • 2
7 Comments
 
LVL 1

Author Comment

by:bluedragon99
ID: 12549686
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
 
LVL 1

Author Comment

by:bluedragon99
ID: 12549745
funny to watch the hosts updating the focus on the rows is jumping cause of the stupid .row on the set image
0
 
LVL 1

Author Comment

by:bluedragon99
ID: 12549858
another flexgrid for the icons and make it blend in on the right side of the host??
0
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.

 
LVL 8

Accepted Solution

by:
mugman21 earned 2000 total points
ID: 12552521
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
 
LVL 1

Author Comment

by:bluedragon99
ID: 12554012
probably would work but the console recieves several updates a second and would be constantly locked
0
 
LVL 8

Expert Comment

by:mugman21
ID: 12554366
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
 
LVL 1

Author Comment

by:bluedragon99
ID: 12554411
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Simple Linear Regression
Progress

807 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