MSFLEXGRID easy question VB6

Posted on 2004-11-10
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
     .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
Question by:bluedragon99
    LVL 1

    Author Comment

    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...
    LVL 1

    Author Comment

    funny to watch the hosts updating the focus on the rows is jumping cause of the stupid .row on the set image
    LVL 1

    Author Comment

    another flexgrid for the icons and make it blend in on the right side of the host??
    LVL 8

    Accepted Solution


    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


    LockWindowUpdate False

    LVL 1

    Author Comment

    probably would work but the console recieves several updates a second and would be constantly locked
    LVL 8

    Expert Comment

    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.

    LVL 1

    Author Comment

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    improve Shell script 5 115
    scoresClump  challenge 31 85
    triangle challenge 4 35
    wordmultiple challenge 12 62
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now