Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Item context menu + doubleclick (Read 3261 times)
Lemings
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Mar 23rd, 2011
Item context menu + doubleclick
Apr 12th, 2011 at 10:41am
Print Post  
Hi,
I am a bit lost again, so it would be great if anybody could help me Smiley
I have 2 problems:
1. how to handle doubleclick of the item in TimeTable view? I would like to open details of the item, but DoubleClick event of calendar doesn't (or i can't see) return the xy coordinates or selected item and i don't see doubleclick in item events.
2. how can i add a context menu to an item? If i add it to a calendar control, i can't get back which item has been selected. I (or the customer...) would like to change some properties of the event by rightclicking the item and changing it in a menu
Thanks a lot for your work!
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Item context menu + doubleclick
Reply #1 - Apr 12th, 2011 at 11:01am
Print Post  
You need to handle the ItemClicked event of the Calendar - it fires for all sort of item clicks - left/right, single/double. Then check the appropriate properties of the event argument to determine the click type. The following example shows how:

Code
Select All
if (e.Clicks == 2 && e.Button == MouseButtons.Left)
{
      calendar1.ResetDrag();
      MessageBox.Show(e.Item.HeaderText + " has been double-clicked.");
}
else if (e.Button == MouseButtons.Right)
{
      MessageBox.Show(e.Item.HeaderText + " has been right-clicked - show menu.");
} 


Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Lemings
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Mar 23rd, 2011
Re: Item context menu + doubleclick
Reply #2 - Apr 12th, 2011 at 11:34am
Print Post  
Hi Meppy, thanks a lot, it works!
One more little question - after i right click, i'd like to display the menu at the position where i have clicked it. But eventargs return position inside the item. Can I get the x,y of an item? I know how to do an inverse thing (pointtoclient, pointtoscreen), but not this. Thanks!
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Item context menu + doubleclick
Reply #3 - Apr 12th, 2011 at 11:59am
Print Post  
You can use the MousePosition property of your Form - it will provide the position in screen coordinates.

Let me know if this works.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Lemings
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Mar 23rd, 2011
Re: Item context menu + doubleclick
Reply #4 - Apr 12th, 2011 at 12:10pm
Print Post  
Thanks, works great Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint