Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rightclick in a listview control

Status
Not open for further replies.

vdeveloper

Programmer
Aug 5, 2000
42
IN
How can I implement rightclick functionality in a listview control? I didnt seem to find such a method for the control.<br><br>thanks <br>
 
vdevelop<br><br>Place a borderless, transparent shape control over part or all of the the listview control.<br><br>The ToolTipText of the shape can be used to advise the user of the right click function, (shape controls have right click methods.)<br><br>Call the methods of the listview control through the methods of the shape control.<br><br>Chris
 
The same goes for a slick trick to get Right Click functionality out of your main foxpro screen&nbsp;&nbsp;with ADDOBJECT()&nbsp;&nbsp;:) <p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href= </a><br>ICQ #9466492<br>
ICQ VFP ActiveList #73897253
 
Thanks Chris for the tip.<br><br>But I have a problem<br><br>I placed a shape control over my listview control with the following attributes<br>borderstyle = 0 - transparent<br>backstyle = 0 - transparent<br>The shape control is also placed in front of the listview<br><br>I wrote a wait window 'Test rightclick' in the rightclick event of the shape to test the functionality. but When I run my form and right click on the listview/shape, the event does not get fire. Am I missing something here?? Please advise<br><br>Thanks in advance<br>
 
vdevelop<br><br>Sorry - unable to recreate your problem. <br><br>The form I used contained only the listview and shape control, and the right click event of the shape works does work with WAIT WINDOW [xxx].<br><br>Perhaps you could create a new form, get the listview and shape working correctly, then add the other controls, checking as you go?<br><br>Chris
 
Hi Vdevelop,<br><br>&nbsp;To answer your original post, use the MouseUp event. If the incoming 'Button' parameter = 2, you've got yourself a right click.<br><br>&nbsp;In addition, I agree with John's post about adding a transparent shape to the _Screen object. It's a great way of tracking mouse events for the _Screen object.<br><br>Chris,<br>&nbsp;I agree with Vdevelop. I havent been able to produce the desired behavior with the MS ListView Control (v6). The ListView Control always seems to be embossed atop the shape control, even when selecting 'Send To Back' in the IDE.<br>&nbsp;Are you sure you're using the ListView ActiveX and not the native VFP Listbox? <p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Carpe Diem! - Seize the Day!
 
Jon Hawkins<br><br>You have a much better answer with your Mouse Up event.<br><br>MS ListView Control (v6) is the control being used, but all I did was place the ListView and shape control together on a form and left it at that, so the ListView control is straight out of the box.<br><br>What are the properties etc of your Listview control which would alter its behaviour?<br><br>Chris
 
Hi Chris,<br><br>&nbsp;I created a base class form, dropped a the ListView control on the form, then dropped a base class shape control on the form, superimposed over the ListView. I set:<br><br>Shape1.BackStyle=0-Transparent<br>Shape1.BorderStyle=0-Transparent<br><br>PROCEDURE Shape1.RightClick()<br>&nbsp;&nbsp;=Messagebox('Right Click',0,'test')<br>ENDPROC<br><br>I go to town on the right mouse button over the ListView and nothing. However, I made the shape control slightly larger than the ListView and when I click on the portion of the shape that is outside the boundaries of the ListView...Voila!...a messagebox.<br><br>No other properties of the form,shape,or ListView are NonDefault.<br><br>Email me your test form: <A HREF="mailto:jonscott8@yahoo.com">jonscott8@yahoo.com</A> <p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Carpe Diem! - Seize the Day!
 
Jon

What I had not done was place the shape accurately over the Listview control and was right clicking outside the Listview control area.

Apologies to vdevelop for sending you in the wrong direction on this occasion.

Jon, your answer remains better anyway. I have problems before with placing shapes over OleControls and was surprised this appeared to work. Had I not been so hasty I would have find out why!

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top