?
Solved

ListView

Posted on 1998-10-19
7
Medium Priority
?
652 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
  • 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
Independent Software Vendors: 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

829 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