Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Context menu on thumbnail item of the RasterThumbnailBrowser
Started by roadman at 09-03-2008 5:05. Topic has 7 replies.

Print Search « Previous Thread Next Thread »
  09-03-2008, 5:05
roadman is not online. Last active: 12/12/2008 4:56:50 AM roadman

Top 25 Posts
Joined on 06-27-2007
Posts 104
Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote

I want to add a context menu when user click on a thumbnail.
However, the selection  cannot be obtained (SelectedItems=0) after a context menu pop up. How can i solve this?

 

 


   Report 
  09-03-2008, 5:14
roadman is not online. Last active: 12/12/2008 4:56:50 AM roadman

Top 25 Posts
Joined on 06-27-2007
Posts 104
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
the problem occur only when i set the SelectionMode = Multi
   Report 
  09-03-2008, 8:48
Maen Hasan is not online. Last active: 1/8/2009 5:45:48 PM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,880
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
The problem might be related to your code.

How exactly do you show the context menu? Do you show the context menu when you click on any thumbnail image?

How exactly do you get the selected items?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
   Report 
  09-03-2008, 9:54
roadman is not online. Last active: 12/12/2008 4:56:50 AM roadman

Top 25 Posts
Joined on 06-27-2007
Posts 104
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
I show the context menu in the MouseDown Event of the browser:

private void rasterThumbnailBrowser_MouseDown(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Left:
break;
case MouseButtons.Right:
contextMenuStrip.Show(MousePosition.X, MousePosition.Y);
break;
case MouseButtons.Middle:
break;
default:
break;
}
}


The scenario is as follows:
1) click (left mouse key) on multiple thumbnail items by holding Ctrl Key to select items i want. (The border of selected items then automatically changed.)

2) click (right mouse key) on any selected items to show the context menu. The context menu was shown ,however all the selection are cleared.



   Report 
  09-04-2008, 2:59
Maen Hasan is not online. Last active: 1/8/2009 5:45:48 PM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,880
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
This is the default behavior. If you want to show the context menu for multiple thumbnail items, you need to hold the Ctrl Key with the right mouse button.

But if you want to show the context menu
without holding the Ctrl key, you may try to do this as follows:
- Before clicking the right mouse button to show the context menu, save the selected items in a RasterImageListItemCollection class.
- Click the right mouse button to show the context menu.
- Reselect the items in the RasterImageListItemCollection class as follows:
+-------+
private void theBrowser_MouseDown(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Left:
break;
case MouseButtons.Right:
                    
contextMenuStrip1.Show(MousePosition.X, MousePosition.Y);
for (int i = 0; i < SelItems.Count; i++)
{
theBrowser.SelectedItems.Add(SelItems[i]);
theBrowser.SelectedItems[i].Selected = true;
}
                    
break;
case MouseButtons.Middle:
break;
default:
break;
}
}

private void theBrowser_SelectedIndexChanged(object sender, EventArgs e)
{
SelItemsCollection = theBrowser.SelectedItems;
}
+-------+

I didn't try the above code, so please try it and let me know how it goes.

Thanks,
Maen Badwan
LEADTOOLS Technical Support

   Report 
  09-15-2008, 13:27
aaron_dan is not online. Last active: 9/16/2008 3:49:17 PM aaron_dan

Not Ranked
Joined on 03-30-2007
Posts 6
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
I'm trying to do this same thing.  I have tried out the sample code, but it is not working for me.  The following line of code appears to be failing:

"theBrowser.SelectedItems.Add(SelItems[i]);"

It does not throw an exception, but the count of "SelectedItems" remains 0 and the next line throws an "Index was out of range" exception.

I know that SelItems[i] contains a valid object (I can copy it, browse it, etc...).  I am also calling RasterCodecs.Startup() earlier in the code.

Any thoughts?  The last update I downloaded was almost a year ago so that could be my issue...

Thanks,

Aaron

   Report 
  09-16-2008, 8:02
Yasir Alani is not online. Last active: 11/16/2008 11:29:23 AM Yasir Alani



Top 10 Posts
Joined on 02-05-2007
Posts 311
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
It is always advisable to update with the latest build.

Please send an email to support@leadtools.com and mention this forum post so I can send you download instructions for the latest patches. Don't forget to include your serial number in the email.

If the new patches don't solve the problem for you, please open a new forum thread or new support ticket, and don't assume your problem is identical to a different user's. If they appear similar, mention the old post in the new thread you open, but always provide complete details in the new thread.


Yasir Alani
LEADTOOLS Technical Support
support@leadtools.com
   Report 
  09-16-2008, 10:50
aaron_dan is not online. Last active: 9/16/2008 3:49:17 PM aaron_dan

Not Ranked
Joined on 03-30-2007
Posts 6
Re: Context menu on thumbnail item of the RasterThumbnailBrowser
Reply Quote
Ok.  I'll do that.  Thanks.
-Aaron

   Report 
Post
LEAD Support Fo... » Developer » Image Display » Context menu on thumbnail item of the RasterThumbnailBrowser

Powered by Community Server, by Telligent Systems