ListView Problem - VB6 Sp5 
Author Message
 ListView Problem - VB6 Sp5

Basically what I'm doing is replicating an Access like query desinger in VB.
When tables are selected from a treeview by checking the node, I'm creating
a new listview control inside  a picture box containing all of the field
names for that table.  The picture box should eventually contain several
listview representing all of the tables selected.

Using LOAD to create a new instance of an existing listview, I find that I'm
unable to move the listbox around in the picture box.   By selecting one of
the list items in the listview control and then rightclicking on empty space
outside the list view but inside the picturebox , the contents of the
listbox dissapear.  It then becomes possible to move the listbox around, but
the contents are corrupt.   Setting the control to visible=false and then
back to true refreshes the control with it's original contents, but also
returns the listview to it's original position and once again it's
un-movable.

Has anyone come across this problem / does anyone know of a workaround for
this problem ?

Any help is appreciated.

Cheers,

Rob.



Mon, 05 Jan 2004 21:10:13 GMT  
 ListView Problem - VB6 Sp5
On Thu, 19 Jul 2001 14:10:13 +0100, BOB

If i understand this,  you can't move the box within the picturebox,
and  you can't move the listitems either within the listbox ?

I've just tried this with two boxes (one dynamic), and no problems
(SP3) . The behaviour is a bit strange as the box lets you move an
icon to the end of the world it seems, when that happens it gets a bit
jerky. At creation the icons (from the original LV)  get dumped on
each other as the first icon in the new listview if you don't have
it's .Arrange set. As they overlap they may look corrupt, but they're
not and can be peeled off one by one.  

Here is my test .. see if this helps. The buttons only move the one
(new) box.
If this doesn't solve it, how about posting some code so we can see
what is going on ?

Option Explicit

Private Sub Command1_Click()
    Load ListView1(ListView1.UBound + 1)
    ListView1(ListView1.UBound).Container = Picture1
    ListView1(ListView1.UBound).Top = ListView1(0).Top
    ListView1(ListView1.UBound).Left = ListView1(0).Left +
ListView1(0).Width
    ListView1(ListView1.UBound).Width = ListView1(0).Width
    ListView1(ListView1.UBound).Height = ListView1(0).Height
    ListView1(ListView1.UBound).Arrange = lvwAutoLeft
    ListView1(ListView1.UBound).Visible = True
End Sub

Private Sub Command2_Click()
    ' move up
    ListView1(1).Top = ListView1(1).Top - 20
End Sub

Private Sub Command3_Click()
    'move left
    ListView1(1).Left = ListView1(1).Left - 20
End Sub

Private Sub Command4_Click()
    'Move down
    ListView1(1).Top = ListView1(1).Top + 20
End Sub

Private Sub Command5_Click()
    'move right
    ListView1(1).Left = ListView1(1).Left + 20
End Sub

Private Sub Form_Load()
    ListView1(0).ListItems.Add , , "Hello"
    ListView1(0).ListItems.Add , , "There"
    ListView1(0).ListItems.Add , , "How are you ?"
End Sub

Regards, Frank.



Mon, 05 Jan 2004 22:51:16 GMT  
 ListView Problem - VB6 Sp5
It sounds like the list box is not getting loaded into the picture box. when
you right click on the picture box it comming to the front and hiding the
listview. Check the listview's parent property and verify it is the picture
box.


Quote:
> Basically what I'm doing is replicating an Access like query desinger in
VB.
> When tables are selected from a treeview by checking the node, I'm
creating
> a new listview control inside  a picture box containing all of the field
> names for that table.  The picture box should eventually contain several
> listview representing all of the tables selected.

> Using LOAD to create a new instance of an existing listview, I find that
I'm
> unable to move the listbox around in the picture box.   By selecting one
of
> the list items in the listview control and then rightclicking on empty
space
> outside the list view but inside the picturebox , the contents of the
> listbox dissapear.  It then becomes possible to move the listbox around,
but
> the contents are corrupt.   Setting the control to visible=false and then
> back to true refreshes the control with it's original contents, but also
> returns the listview to it's original position and once again it's
> un-movable.

> Has anyone come across this problem / does anyone know of a workaround for
> this problem ?

> Any help is appreciated.

> Cheers,

> Rob.



Wed, 07 Jan 2004 22:21:10 GMT  
 ListView Problem - VB6 Sp5
Thanks for the reply Frank, and apologies for the delay in responding - I
was off work on Friday.

The solution you've provided works fine Frank.   The thing I'd forgotten to
mention in my original post is that I was trying to create an ActiveX
control, and provide this functionality within a control.   It's running it
as a control that I encounter my problem.   I created a new control, dropped
your code and the objects in and I get a similar response to my original
control.

I made a couple of changes to your code, basically moving the code from
Form_Load to UserControl_Initialise.
Also. set the view property of the listview to 3, lvwReport.

The problem seems to occur when I set the dragmode property of the listview
from vbManual to vbAutomatic.   If you try that you should be able to see
the problem occuring.

Cheers,

Rob.

----------------Code -------------------------------------

Option Explicit

Private Sub Command1_Click()
    Load ListView1(ListView1.UBound + 1)
    ListView1(ListView1.UBound).Container = Picture1
    ListView1(ListView1.UBound).Top = ListView1(0).Top
    ListView1(ListView1.UBound).Left = ListView1(0).Left +
ListView1(0).Width
    ListView1(ListView1.UBound).Width = ListView1(0).Width
    ListView1(ListView1.UBound).Height = ListView1(0).Height
    ListView1(ListView1.UBound).Arrange = lvwAutoLeft
    ListView1(ListView1.UBound).Visible = True
End Sub

Private Sub Command2_Click()
    ' move up
    ListView1(1).Top = ListView1(1).Top - 20
End Sub

Private Sub Command3_Click()
    'move left
    ListView1(1).Left = ListView1(1).Left - 20
End Sub

Private Sub Command4_Click()
    'Move down
    ListView1(1).Top = ListView1(1).Top + 20
End Sub

Private Sub Command5_Click()
    'move right
    ListView1(1).Left = ListView1(1).Left + 20
End Sub

Private Sub UserControl_Initialize()
    ListView1(0).ColumnHeaders.Add , , "TEST!"
    ListView1(0).ListItems.Add , , "Hello"
    ListView1(0).ListItems.Add , , "There"
    ListView1(0).ListItems.Add , , "How are you ?"
End Sub



Fri, 09 Jan 2004 22:31:51 GMT  
 ListView Problem - VB6 Sp5
On Mon, 23 Jul 2001 15:31:51 +0100, BOB

Quote:

>The problem seems to occur when I set the dragmode property of the listview
>from vbManual to vbAutomatic.   If you try that you should be able to see
>the problem occuring.

Ahh, but if you set dragmode to auto, as soon as you press the mouse
you are invoking the drag method, so moving things is out of the
question.  I can honestly say i have not found much use for automatic
dragging, most of the time the side effects are not worth the trouble.

Is there a reason why you can't do the drag manually ?

<snip>

Regards, Frank.



Fri, 09 Jan 2004 23:30:00 GMT  
 ListView Problem - VB6 Sp5
Frank,

I was trying to implement an Access like query builder for the users of a
project I'm working on as most of the users have had some exposure to
access.

I've given up on the Automatic drag and drop and gone with the Manual drag
and drop, I had thought that I'd just got a property wrong or was doing
something silly, but then decided it was a buggy control and wondered if
anyone had a work-around.

Thanks for your help though!!!!

Cheers,

Rob.


Quote:
> On Mon, 23 Jul 2001 15:31:51 +0100, BOB

> >The problem seems to occur when I set the dragmode property of the
listview
> >from vbManual to vbAutomatic.   If you try that you should be able to see
> >the problem occuring.

> Ahh, but if you set dragmode to auto, as soon as you press the mouse
> you are invoking the drag method, so moving things is out of the
> question.  I can honestly say i have not found much use for automatic
> dragging, most of the time the side effects are not worth the trouble.

> Is there a reason why you can't do the drag manually ?

> <snip>

> Regards, Frank.



Sat, 10 Jan 2004 18:28:39 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. ListView Problem - VB6 Sp5

2. VB6 SP5 Treeview/Listview redraw problem

3. VB6 SP5 not compatible with pre SP5???

4. VB6 SP5 Problem Adding Watches

5. VB6 SP5 problem in DE

6. Problem with MaskEdBox control VB6:SP5

7. Problem : Bound UserControl not updating recordset - VB6 SP5

8. VB6 SP5 Progress Bar problem.

9. VB6 (SP5) and CR 8.5 Dev Problems...

10. Memory problem VB6 SP5 + win2K sp1

11. VB6 - SP5 exe generates drWatson during OLE communication with VB6 - SP3 exe

12. listview printing in vb 6 sp5

 

 
Powered by phpBB® Forum Software