?
Solved

ListView

Posted on 1998-10-19
7
Medium Priority
?
645 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 80 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

741 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