Solved

ListView

Posted on 1998-10-19
7
643 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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