Solved

ListView

Posted on 1998-10-19
7
642 Views
Last Modified: 2013-12-25
I want to select(show focus) all the subitems when I select particular list item in a list view with lvwReport View.I want show just like selecting a row when user clicks any item in a listview.

Any help or sample code??

Thanx
0
Comment
Question by:anilkumarv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 20 total points
ID: 1487825
VB6 has ListView control with property FullRowSelect.
In VB5, add this declarations to your module:
Public Const LVM_FIRST = &H1000
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Long, ByVal msg As Long, _
       ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const LVS_FULLROWSELECT = &H20
Public Const LVS_EX_ONECLICKACTIVATE = &H40
Public Const LVS_EX_TWOCLICKACTIVATE = &H80

In your form, add this code in Form_Load event:
    With ListView1
        ' get the current ListView style
        rStyle = SendMessageLong(.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
        rStyle = rStyle Or LVS_EX_ONECLICKACTIVATE Or LVS_FULLROWSELECT
        ' set the new ListView style
        r = SendMessageLong(.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
    End With

0
 

Author Comment

by:anilkumarv
ID: 1487826
Thanx ameba,

Your code has solved my problem.

I have one more query, posting as a question
0
 

Author Comment

by:anilkumarv
ID: 1487827
I want some documentation about the different parameters like LVM_SETEXTENDEDLISTVIEWSTYLE in the case of listview, to be passed to API's ??

How to get expertize in customizing the controls??

Any Suggestion???
0
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!

 

Author Comment

by:anilkumarv
ID: 1487828
I want some documentation about the different parameters like LVM_SETEXTENDEDLISTVIEWSTYLE in the case of listview, to be passed to API's ??

How to get expertize in customizing the controls??

Any Suggestion???
0
 
LVL 15

Expert Comment

by:ameba
ID: 1487829
Don't customize too much. Try using regular VB properties. One day you will have to upgrade, and then you will have to delete a lot of code. In VB6 you will have more properties for listview, like Picture (for background), HotTracking, GridLines, CheckBoxes ...
Some constants you can try, use OR for combinations as in answer
       Public Const LVS_EX_GRIDLINES = &H1
       Public Const LVS_EX_CHECKBOXES = &H4
       Public Const LVS_EX_HEADERDRAGDROP = &H10
       Public Const LVS_EX_TRACKSELECT = &H8

0
 

Author Comment

by:anilkumarv
ID: 1487830
Thanx ameba,

Your code has solved my problem.

I have one more query, posting as a question
0
 
LVL 15

Expert Comment

by:ameba
ID: 1487831
Answer to your question on multiselect is correct.
For ListView not possible.
For FlexGrid, perhaps you can cheat :)
Property SelectionMode must be 0. When user selects an area, set background of selected cells to HIGHLIGHT (blue) color, save selection to a structure.
Type TP_SEL
 startcol as integer
 endcol as integer
 startrow as integer
 endrow as integer
End Type
Dim selections() as TP_SEL
Dim numselections as integer

When user clicks again holding CTRL, redimension your array to hold one selection more.
If not holding CTRL, start again: Redim selections(1)
Too complicated, isn't it?
0

Featured Post

Technology Partners: 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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

749 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