Results 1 to 6 of 6

Thread: ListView select / MsgBox bug?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    There seems to be a problem when an item is selected in a ListView and on
    that same form, if you launch a MsgBox and then when it closes, the selected
    item flickers about 3 times..

    I guess it has something to do with when the focus is released from the MsgBox after
    it closes, and it goes back to the selected item, it causes this flicker problem..

    You can test and verify this by creating a form with a listview. Add just a single item, select it and hit a command button which pops up a msgbox. As soon as you close the msgbox,
    you should see that the selected item flickers..

    Does anyone have a fix for this? It looks too cheesy to release to my end users in this state..

    Thanks,

    Dan

  2. #2
    Addicted Member eer3's Avatar
    Join Date
    Sep 2000
    Location
    Ca
    Posts
    165
    I could not reproduce the problem you are having on an NT SP6,VS6 SP3. I tested it with both the common controls 5 and 6 listview controls.

    Was there any other setup on the listview you tested(like HotTracking)?

    What is your current configuration(service packs/versions)?

  3. #3
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    I, too, haven't seen the flicker with the ListView. And I am using many listviews in my project along with a host of other controls such as grids, radio buttons and command buttons. I am using Win 98 VB6 SP3.

    dbassettt74, Is there some code that you are executing in the GotFocus or ItemClick or some such event of the Listview control?

    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Okay guys, I started from scratch in an effort to duplicate my problem because there were far too many things I had going on in my original project that couldn't caused the problem..

    I was able to duplicate it. It seems that the problem is a combination of having more than a few columns and more than a few items. When I have just 1 column and 1 item, no flicker occurs. But, when I have hundreds of items and about 8 columns, the flicker does occur.

    But what's interesting is when I compile it, the flickering is reduced, but not eliminated..

    See if you can duplicate the problem following my instructions below so that maybe we can see if we can find a resolution. I have been able to duplicate this problem on 3 different machines.

    Create a form with a listview and 1 menu item named mnuTest. Paste the following code in the form's module and run it. Make sure an item is selected. Click the menu item and hit okay on the msgbox. Once the msgbox closes, focus should be sent back to the selected item and flickering should occur..

    Code:
    Private Sub Form_Load()
        Dim l As Integer
        
        '-- load listview properties
        With ListView1
            .View = lvwReport
            .HideSelection = True
            .FullRowSelect = True
            .LabelEdit = lvwManual
            .MultiSelect = True
        End With
        
        '-- load columns
        With ListView1
            .ColumnHeaders.Clear
            .ColumnHeaders.Add , , "Col1", 1500
            .ColumnHeaders.Add , , "Col2", 1500
            .ColumnHeaders.Add , , "Col3", 1500
            .ColumnHeaders.Add , , "Col4", 1500
            .ColumnHeaders.Add , , "Col5", 1500
            .ColumnHeaders.Add , , "Col6", 1500
            .ColumnHeaders.Add , , "Col7", 1500
            .ColumnHeaders.Add , , "Col8", 1500
            .ColumnHeaders.Add , , "Col9", 1500
        End With
    
        '-- populate list with data
        With ListView1.ListItems
            For l = 1 To 1000
                With .Add(, , "test")
                End With
            Next l
        End With
    
    End Sub
    
    
    Private Sub mnuTest_Click()
        MsgBox "test"
    End Sub
    Any help on solving this problem would be appreciated..

    Dan

  5. #5
    Addicted Member eer3's Avatar
    Join Date
    Sep 2000
    Location
    Ca
    Posts
    165
    Yes, that is a problem. I don't have an answer as to why, but I found a work around.

    Add an extra form to your project and use it instead of the msgbox. Call it modally so that it forces the user to make a descision before any other process in your application can run. Be sure to unload the form when your done with it.

    Form2.Show vbModal


    Hope this helps, good luck!

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Yep, that did it!! I just discovered this myself and was going to post it but you beat me to it!

    Strange problem, huh? Must be something to do with the code behind the MsgBox function..

    Ohwell, glad we found a work around..

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width