×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Rightclick in a listview control

Rightclick in a listview control

Rightclick in a listview control

(OP)
How can I implement rightclick functionality in a listview control? I didnt seem to find such a method for the control.

thanks

RE: Rightclick in a listview control

vdevelop

Place a borderless, transparent shape control over part or all of the the listview control.

The ToolTipText of the shape can be used to advise the user of the right click function, (shape controls have right click methods.)

Call the methods of the listview control through the methods of the shape control.

Chris

RE: Rightclick in a listview control

The same goes for a slick trick to get Right Click functionality out of your main foxpro screen  with ADDOBJECT()  :)

John Durbin
john@johndurbin.com

ICQ #9466492
ICQ VFP ActiveList #73897253

RE: Rightclick in a listview control

(OP)
Thanks Chris for the tip.

But I have a problem

I placed a shape control over my listview control with the following attributes
borderstyle = 0 - transparent
backstyle = 0 - transparent
The shape control is also placed in front of the listview

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

Thanks in advance

RE: Rightclick in a listview control

vdevelop

Sorry - unable to recreate your problem.

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].

Perhaps you could create a new form, get the listview and shape working correctly, then add the other controls, checking as you go?

Chris

RE: Rightclick in a listview control

Hi Vdevelop,

 To answer your original post, use the MouseUp event. If the incoming 'Button' parameter = 2, you've got yourself a right click.

 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.

Chris,
 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.
 Are you sure you're using the ListView ActiveX and not the native VFP Listbox?

Jon Hawkins
jonscott8@yahoo.com

Carpe Diem! - Seize the Day!

RE: Rightclick in a listview control

Jon Hawkins

You have a much better answer with your Mouse Up event.

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.

What are the properties etc of your Listview control which would alter its behaviour?

Chris

RE: Rightclick in a listview control

Hi Chris,

 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:

Shape1.BackStyle=0-Transparent
Shape1.BorderStyle=0-Transparent

PROCEDURE Shape1.RightClick()
  =Messagebox('Right Click',0,'test')
ENDPROC

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.

No other properties of the form,shape,or ListView are NonDefault.

Email me your test form: jonscott8@yahoo.com

Jon Hawkins
jonscott8@yahoo.com

Carpe Diem! - Seize the Day!

RE: Rightclick in a listview control

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close