Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need An ActiveX Control
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00992033
Message ID:
00992272
Views:
35
>I'm not looking for drag and drop.
>
>I want to drag the mouse over list items and have
>them be selected.
That is what the hittest methods is used for. As the mouse moves across the rows, hittest will provide a "node" referencewhhich can and allow the node to be selected. If the mosue moves across three nodes, three nodes will be selected. No clicks required except you may want to use a click to strat the copy and paste. Paste this into a prg and run:
* HITTEST.PRG
PUBLIC frmHT,unLTVX,unltvY
frmHt=CREATEOBJECT('clsform')
frmHt.addobject('ocxLV','clsListView','MSComctlLib.ListViewCtrl.2')
WITH frmHt.ocxLV
.height=frmHt.height-4
.width=frmHt.width-4
.tag="X"
.view=3
.labelwrap=.f.
.labeledit=1
.multiselect=.t.
.borderstyle=1
.appearance=0
.fullrowselect=.t.
.gridlines=.t.
.COLUMNHEADERS.ADD(,[row],[List View rows],.width-SYSMETRIC(5),,)
.listitems.ADD(,"A","List view row number A",,)
.listitems.ADD(,"B","List view row number B",,)
.listitems.ADD(,"C","List view row number C",,)
.listitems.ADD(,"D","List view row number D",,)
.listitems.ADD(,"E","List view row number E",,)
.listitems.ADD(,"F","List view row number F",,)
ENDWITH 
frmht.show

DEFINE CLASS clsListView as olecontrol
top=2
left=2
PROCEDURE MouseMove(button, shift, x, y)
oNode=this.HitTest(X*unLTVX,Y*unltvY)
IF type('oNode.text')==[C] AND oNode.key#this.tag
   this.tag=oNode.key
   oNode.selected=.t.
ENDIF 
ENDPROC
visible=.t.
ENDDEFINE 

DEFINE CLASS clsform as Form
caption="Move Mouse Over List To Select"
PROCEDURE init
GetDisplayMetrics()
ENDPROC 
PROCEDURE queryunload
this.Release
ENDPROC
ENDDEFINE 

PROCEDURE GetDisplayMetrics
local liHwnd,liHDC,liPixelsPerInchX,liPixelsPerInchY
declare integer GetActiveWindow in WIN32API
declare integer GetDC in WIN32API integer iHDC
declare integer GetDeviceCaps in WIN32API integer iHDC,integer iIndex
* Device context
liHwnd=GetActiveWindow()
liHDC=GetDC(liHwnd)
* Pixels per Inch
liPixelsPerInchX=GetDeviceCaps(liHDC,88)
liPixelsPerInchY=GetDeviceCaps(liHDC,90)
* Twips per pixel and store
unLTVX=1440/liPixelsPerInchX
unLTVY=1440/liPixelsPerInchY
ENDPROC
* END HITTEST.PRG
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform