Solved

Listview

Posted on 1998-07-02
6
188 Views
Last Modified: 2010-05-03
1.) Is there a way that the whole line becomes selected when I select a row in report mode ?
     Only the first column items get selected, not the subitems.

2.) Is there a way to use different colors for different rows ?

 
0
Comment
Question by:tstrob
  • 3
  • 3
6 Comments
 
LVL 1

Accepted Solution

by:
Geffl earned 50 total points
ID: 1464775
To select the entire row you just have to make a simple API call:
Declaration:
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 FIRSTADR = &H1000
       Public Const SETEXTLVSTYLE = FIRSTADR + 54
       Public Const GETEXTLVSTYLE = FIRSTADR + 55
       Public Const FULLROWSEL = &H20
Then use as follows:
       Dim Style As Long
       Dim x As Long
       'check Style
       Style = SendMessageLong(ListView.hwnd, GETEXTLVSTYLE, 0&, 0&)
       
       'to remove the FullRowSelection:
       Style = Style Xor FULLROWSEL
       'to set the FullRowSelection
       Style = Style Or FULLROWSEL
       'To apply just call
       r = SendMessageLong(ListView.hwnd, SETEXTLVSTYLE, 0&, Style)
Have fun
0
 
LVL 1

Author Comment

by:tstrob
ID: 1464776
Geffl,

thank you. This works.
Do you (or someone else) has an idea for the colors ?
0
 
LVL 1

Expert Comment

by:Geffl
ID: 1464777
I don´t know how to set different colors. But if it´s enough you can set Gridlines in the same way. Just Or with &H1 , Xor with &H1 (Define a global const for &H1: EXTLVGRID)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:tstrob
ID: 1464778
Geffl,

thank you. This works.
Do you (or someone else) has an idea for the colors ?
0
 
LVL 1

Author Comment

by:tstrob
ID: 1464779
Geffl,

is there also a way to forbid the user to resize the columnheaders ?

tnx
0
 
LVL 1

Expert Comment

by:Geffl
ID: 1464780
I don´t think so. For such things it would be better to use a third party grid control.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

948 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now