Tree View and List View Misbehavior

  • Thread starter Thread starter Henry Smith
  • Start date Start date
H

Henry Smith

Running Win XP Pro and Access 2000 SP1
I have a ActiveX List View control associated with a Tree View Control.
Under some circumstances when I click a subject in the Tree View control the
list view control grows. The list view display becomes larger because it
thinks it can't display all the information that the tree view provides.
The list view is one panel of a number of panels and controls on this
particular form.
How can I limit the size of the List View control displayed on the screen
regardless of the number of records it has to display?

Any help will be greatly appreciated.
Cheers,
Henry
 
Hi Henry,

Do you mean the ListView control becomes larger when it contains enough
information? Would you please post more information about the scenario? How
about if you change LabelWrap property's value?


Please feel free to reply to the threads if you have any concerns or
questions.



Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Henry Smith" <[email protected]>
| Subject: Tree View and List View Misbehavior
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Running Win XP Pro and Access 2000 SP1
| I have a ActiveX List View control associated with a Tree View Control.
| Under some circumstances when I click a subject in the Tree View control
the
| list view control grows. The list view display becomes larger because it
| thinks it can't display all the information that the tree view provides.
| The list view is one panel of a number of panels and controls on this
| particular form.
| How can I limit the size of the List View control displayed on the screen
| regardless of the number of records it has to display?
|
| Any help will be greatly appreciated.
| Cheers,
| Henry
|
|
|
 
I have a form with both a tree view and list view control. The action is
that when I click on a node in the tree view control the underlying items of
the node are displayed as a list in the list view as well as the node
expands in the tree view like it is supposed to do.. Each time I click on a
tree view node and a listing appears in the list view control the height of
the control grows. It doesn't grow up and down, just down. I guess it can't
go up because the top edge of the list view is at the top edge of the
control.
I get the growth with only three items in the list or 20+ items in the list.
With approximately 23 items displayed in the list there is still blank space
for several more items in the list. No vertical scroll bar is ever
displayed.
As I click on various nodes of the tree view the list view grows, covers up
other controls I have at the bottom of the form, and continues to grow with
each new node selection. With the first click the growth is minimal, but
with each successive click the growth is more noticeable, especially if has
to display 20+ list items. The growth continues until it reaches the bottom
of the form. LabelWrap property has no affect perhaps because none of the
items in list are long enough to initiate LabelWrap. Closing the form and
then reopen it will reset the list view control back to its desired size.
I set the size of the list view with the design properties dialog. There is
no size data in the VBA code for the form.

Looking forward to your reply.

Cheers,
Henry
 
Hi Henry,

Thanks for the detailed description. It seems what happened is:

1. You have one treeview control and one listview control on the form with
other some controls.

2. When you click the nodes in the Treeview control, the node lists all its
children within the treeview control, this is not a problem; the children
information is passed to the listview control and it is also displayed in
the listview control, the problem is the displaying of the items within the
listview control.

3. The listview control doesn't show the vertical scroll bar even if there
are many list items, and it grows when the items increase, its height'
value becomes bigger, the size of the listview control changes?!

If this is the issue and there is no code to do the size changing, it is
weird; please follow the steps below and see what happens:

1. Create a new database file with one form.
2. Add one listview control on the form.
3. On the form load event, copy and paste the code below:


ListView1.ColumnHeaders. _
Add , , "Author", ListView1.Width / 3
ListView1.ColumnHeaders. _
Add , , "Author ID", ListView1.Width / 3, _
lvwColumnCenter
ListView1.ColumnHeaders. _
Add , , "Birthdate", ListView1.Width / 3
ListView1.View = lvwReport

' Declare a variable to add ListItem objects.
Dim itmX As ListItem

Dim j As Integer

For j = 0 To 100

Set itmX = ListView1.ListItems.Add(, , CStr(j))

itmX.SubItems(1) = CStr(j) & "1"
itmX.SubItems(2) = CStr(j) & "2"

Next

4. Save the change and run the form.
5. Does the listview control's size change?

Please feel free to reply to the threads if you have any concerns or
questions.



Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Henry Smith" <[email protected]>
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| I have a form with both a tree view and list view control. The action is
| that when I click on a node in the tree view control the underlying items
of
| the node are displayed as a list in the list view as well as the node
| expands in the tree view like it is supposed to do.. Each time I click
on a
| tree view node and a listing appears in the list view control the height
of
| the control grows. It doesn't grow up and down, just down. I guess it
can't
| go up because the top edge of the list view is at the top edge of the
| control.
| I get the growth with only three items in the list or 20+ items in the
list.
| With approximately 23 items displayed in the list there is still blank
space
| for several more items in the list. No vertical scroll bar is ever
| displayed.
| As I click on various nodes of the tree view the list view grows, covers
up
| other controls I have at the bottom of the form, and continues to grow
with
| each new node selection. With the first click the growth is minimal, but
| with each successive click the growth is more noticeable, especially if
has
| to display 20+ list items. The growth continues until it reaches the
bottom
| of the form. LabelWrap property has no affect perhaps because none of the
| items in list are long enough to initiate LabelWrap. Closing the form and
| then reopen it will reset the list view control back to its desired size.
| I set the size of the list view with the design properties dialog. There
is
| no size data in the VBA code for the form.
|
| Looking forward to your reply.
|
| Cheers,
| Henry
|
| | > Hi Henry,
| >
| > Do you mean the ListView control becomes larger when it contains enough
| > information? Would you please post more information about the scenario?
| How
| > about if you change LabelWrap property's value?
| >
| >
| > Please feel free to reply to the threads if you have any concerns or
| > questions.
| >
| >
| >
| > Sincerely,
| >
| > Alick Ye, MCSD
| > Product Support Services
| > Microsoft Corporation
| > Get Secure! - <www.microsoft.com/security>
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Henry Smith" <[email protected]>
| > | Subject: Tree View and List View Misbehavior
| > | X-Tomcat-NG: microsoft.public.access.formscoding
| > |
| > | Running Win XP Pro and Access 2000 SP1
| > | I have a ActiveX List View control associated with a Tree View
Control.
| > | Under some circumstances when I click a subject in the Tree View
control
| > the
| > | list view control grows. The list view display becomes larger because
it
| > | thinks it can't display all the information that the tree view
provides.
| > | The list view is one panel of a number of panels and controls on this
| > | particular form.
| > | How can I limit the size of the List View control displayed on the
| screen
| > | regardless of the number of records it has to display?
| > |
| > | Any help will be greatly appreciated.
| > | Cheers,
| > | Henry
| > |
| > |
| > |
| >
|
|
|
 
Alick,
Thank you for the ideas on solving my problem. However, I solved the
problem in my application by doing two things. I will keep your ideas in
mind the next time I design a TreeView and ListView on the same form.
Here is what works for me.
1. In From Load event I provided specific dimensions (twips) for the Left,
Top, Width and Height of the list view control and a Progress Bar control.
(my progress Bar was growing also).
2. Inside each procedure (there are several) that fills the ListView Control
when I click on a node in the Tree View control I added the specific
dimension properties that I used in the Form Load event. Did the same for
the Progress Bar control. All works as it should. I guess the controls
needed specific size properties in the code in addition to what is listed in
the control's design properties dialog box.
Now when I click on a Node in the TreeView control the ListView lists the
underlying hierarchical level of data with the appropriate column headers.
If the number of items listed exceeds the height of the ListView a vertical
scroll bar automatically (part of ListView characteristics) appears so the
user can scroll through the whole list. The control size does not change.

Problem solved with a few extra lines of code in the right places.

Cheers,
Henry
 
Hi Henry,

Thank you for sharing the resolution with us :- )


Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| From: "Henry Smith" <[email protected]>
| References: <[email protected]> <rzbdli2pDHA.2088
|
| Alick,
| Thank you for the ideas on solving my problem. However, I solved the
| problem in my application by doing two things. I will keep your ideas in
| mind the next time I design a TreeView and ListView on the same form.
| Here is what works for me.
| 1. In From Load event I provided specific dimensions (twips) for the
Left,
| Top, Width and Height of the list view control and a Progress Bar control.
| (my progress Bar was growing also).
| 2. Inside each procedure (there are several) that fills the ListView
Control
| when I click on a node in the Tree View control I added the specific
| dimension properties that I used in the Form Load event. Did the same for
| the Progress Bar control. All works as it should. I guess the controls
| needed specific size properties in the code in addition to what is listed
in
| the control's design properties dialog box.
| Now when I click on a Node in the TreeView control the ListView lists the
| underlying hierarchical level of data with the appropriate column headers.
| If the number of items listed exceeds the height of the ListView a
vertical
| scroll bar automatically (part of ListView characteristics) appears so the
| user can scroll through the whole list. The control size does not change.
|
| Problem solved with a few extra lines of code in the right places.
|
| Cheers,
| Henry
|
| | > Hi Henry,
| >
| > Thanks for the detailed description. It seems what happened is:
| >
| > 1. You have one treeview control and one listview control on the form
with
| > other some controls.
| >
| > 2. When you click the nodes in the Treeview control, the node lists all
| its
| > children within the treeview control, this is not a problem; the
children
| > information is passed to the listview control and it is also displayed
in
| > the listview control, the problem is the displaying of the items within
| the
| > listview control.
| >
| > 3. The listview control doesn't show the vertical scroll bar even if
there
| > are many list items, and it grows when the items increase, its height'
| > value becomes bigger, the size of the listview control changes?!
| >
| > If this is the issue and there is no code to do the size changing, it is
| > weird; please follow the steps below and see what happens:
| >
| > 1. Create a new database file with one form.
| > 2. Add one listview control on the form.
| > 3. On the form load event, copy and paste the code below:
| >
| >
| > ListView1.ColumnHeaders. _
| > Add , , "Author", ListView1.Width / 3
| > ListView1.ColumnHeaders. _
| > Add , , "Author ID", ListView1.Width / 3, _
| > lvwColumnCenter
| > ListView1.ColumnHeaders. _
| > Add , , "Birthdate", ListView1.Width / 3
| > ListView1.View = lvwReport
| >
| > ' Declare a variable to add ListItem objects.
| > Dim itmX As ListItem
| >
| > Dim j As Integer
| >
| > For j = 0 To 100
| >
| > Set itmX = ListView1.ListItems.Add(, , CStr(j))
| >
| > itmX.SubItems(1) = CStr(j) & "1"
| > itmX.SubItems(2) = CStr(j) & "2"
| >
| > Next
| >
| > 4. Save the change and run the form.
| > 5. Does the listview control's size change?
| >
| > Please feel free to reply to the threads if you have any concerns or
| > questions.
| >
| >
| >
| > Sincerely,
| >
| > Alick Ye, MCSD
| > Product Support Services
| > Microsoft Corporation
| > Get Secure! - <www.microsoft.com/security>
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Henry Smith" <[email protected]>
| > | X-Tomcat-NG: microsoft.public.access.formscoding
| > |
| > | I have a form with both a tree view and list view control. The action
| is
| > | that when I click on a node in the tree view control the underlying
| items
| > of
| > | the node are displayed as a list in the list view as well as the node
| > | expands in the tree view like it is supposed to do.. Each time I
click
| > on a
| > | tree view node and a listing appears in the list view control the
height
| > of
| > | the control grows. It doesn't grow up and down, just down. I guess it
| > can't
| > | go up because the top edge of the list view is at the top edge of the
| > | control.
| > | I get the growth with only three items in the list or 20+ items in the
| > list.
| > | With approximately 23 items displayed in the list there is still blank
| > space
| > | for several more items in the list. No vertical scroll bar is ever
| > | displayed.
| > | As I click on various nodes of the tree view the list view grows,
covers
| > up
| > | other controls I have at the bottom of the form, and continues to grow
| > with
| > | each new node selection. With the first click the growth is minimal,
| but
| > | with each successive click the growth is more noticeable, especially
if
| > has
| > | to display 20+ list items. The growth continues until it reaches the
| > bottom
| > | of the form. LabelWrap property has no affect perhaps because none of
| the
| > | items in list are long enough to initiate LabelWrap. Closing the form
| and
| > | then reopen it will reset the list view control back to its desired
| size.
| > | I set the size of the list view with the design properties dialog.
| There
| > is
| > | no size data in the VBA code for the form.
| > |
| > | Looking forward to your reply.
| > |
| > | Cheers,
| > | Henry
| > |
| > | | > | > Hi Henry,
| > | >
| > | > Do you mean the ListView control becomes larger when it contains
| enough
| > | > information? Would you please post more information about the
| scenario?
| > | How
| > | > about if you change LabelWrap property's value?
| > | >
| > | >
| > | > Please feel free to reply to the threads if you have any concerns or
| > | > questions.
| > | >
| > | >
| > | >
| > | > Sincerely,
| > | >
| > | > Alick Ye, MCSD
| > | > Product Support Services
| > | > Microsoft Corporation
| > | > Get Secure! - <www.microsoft.com/security>
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | >
| > | > --------------------
| > | > | From: "Henry Smith" <[email protected]>
| > | > | Subject: Tree View and List View Misbehavior
| > | > | X-Tomcat-NG: microsoft.public.access.formscoding
| > | > |
| > | > | Running Win XP Pro and Access 2000 SP1
| > | > | I have a ActiveX List View control associated with a Tree View
| > Control.
| > | > | Under some circumstances when I click a subject in the Tree View
| > control
| > | > the
| > | > | list view control grows. The list view display becomes larger
| because
| > it
| > | > | thinks it can't display all the information that the tree view
| > provides.
| > | > | The list view is one panel of a number of panels and controls on
| this
| > | > | particular form.
| > | > | How can I limit the size of the List View control displayed on the
| > | screen
| > | > | regardless of the number of records it has to display?
| > | > |
| > | > | Any help will be greatly appreciated.
| > | > | Cheers,
| > | > | Henry
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Back
Top