Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List View Contribution
Message
From
26/10/1998 11:11:11
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
To
26/10/1998 10:09:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149975
Message ID:
00150519
Views:
21
The listview is an Active X control. It was a pain before to use before. It is the control used in the right hand pane of Explorer. If you notice in explorer you can only select a file by highlighting the filename, not any of the other columns. Sometimes when you use this control on a form, users want to be able to select the row from 'anywhere'.

What I like is having a way to access extended properties of the control. The down side is, the new control MSCOMCTRL (version 6) exposes those extra properties that were always there but not accessible. So you don't need my method to do it. But you do if you use VFP 5 or the version 5 control in COMCTRL32.



>Bob -
>
>You were so enthusiastic about this, I had to print out your note even though I have no idea what the Listview is. Can you tell me?
>
>Thanks,
>
>Sylvia
>
>
>>I don't know about you, but I have found list views kind of a pain because only the first column could be clicked on or selected. What I didn't realize was that the listview supports much more than this, but didn't expose these properties and methods in the OCX. Naughty, naughty!
>>
>>However, I have a quick and easy method to highlight the whole list line, to allow selection at any point, and to allow highlighting just by having the mouse pointer hovering on a line.
>>
>>This stuff is just too good not to share!
>>
>>The code has not been cleaned up, but it works! Some is not necessary. So? Delete what you don't need.
>>
>>Add a list view to a form. Name it oleListView and then add this code to the init of the form. Also add three headers to the list view (using properties and right-click on the Listview control.) set the width to 100 for each header.
>>
>>#DEFINE LVM_FIRST = 0x1000
>>#DEFINE LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
>>#DEFINE LVS_EX_GRIDLINES = 0x1
>>#DEFINE LVS_EX_SUBITEMIMAGES = 0x2
>>#DEFINE LVS_EX_CHECKBOXES = 0x4
>>#DEFINE LVS_EX_TRACKSELECT = 0x8
>>#DEFINE LVS_EX_HEADERDRAGDROP = 0x10
>>#DEFINE LVS_EX_FULLROWSELECT = 0x20 && applies to report mode only
>>#DEFINE LVS_EX_ONECLICKACTIVATE = 0x40
>>#DEFINE LVS_EX_TWOCLICKACTIVATE = 0x80
>>
>>
>> Declare INTEGER SendMessage IN user32.dll ;
>> integer hwnd, integer wMsg, Integer wParam, integer lParam
>>
>> Declare Integer FindWindowEx IN user32 ;
>> integer hWnd1, integer hWnd2 , string lpsz1, string lpsz2
>> Declare integer GetSystemMetrics In user32 integer nIndex
>>
>>a = thisform.OleListView.hwnd
>>b = 0x1000 + 54
>>c = BITOR(0x20, 0x8)
>>
>>Result = SendMessage(a, b, c, c)
>>
>>* Result = SendMessage(a, b, c, c)
>>
>>
>>thisform.OleListView.View = 3
>>
>> lo = thisform.OleListView.ListItems.Add(,"Key1","this is the first item",0,0)
>>
>> lo.SubItems(1) = "Fruit"
>>
>> lo.SubItems(2) = "Oranges"
>> lo = thisform.OleListView.ListItems.Add(,"Key2","Select here for item two",0,0)
>>
>> lo.SubItems(1) = "Vegetable"
>>
>> lo.SubItems(2) = "Potato"
>>
>> lo = thisform.OleListView.ListItems.Add(,"Key3","Last item in list",0,0)
>>
>> lo.SubItems(1) = "Soup"
>>
>> lo.SubItems(2) = "Chicken Noodle"
Previous
Reply
Map
View

Click here to load this message in the networking platform