Welcome to LEAD Support Forum Login | Register | Faq  

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

Programmatically select RasterImageListItem in RasterThumbnailBrowser
Started by roadman at 09-02-2008 12:17. Topic has 2 replies.

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

Top 25 Posts
Joined on 06-27-2007
Posts 104
Programmatically select RasterImageListItem in RasterThumbnailBrowser
Reply Quote
How can I simulate a click event (= select) on a RasterImageListItem in the RasterThumbnailBrowser.

I have tried RasterThumbnailBrowser.Items[x].Selected = true. It can select the item, however, the behaviour is not the same as the mouse click on the item.

1) The border of the item (usin .Items[x].Selected = true) is thicker than that of the mouse click on the item.

2) item (using .Items[x].Selected = true) is permanently selected even when i click other items.
   Report 
  09-02-2008, 16:00
jigar is not online. Last active: 12/12/2008 5:08:42 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 480
Re: Programmatically select RasterImageListItem in RasterThumbnailBrowser
Reply Quote
Hello,

1.  What display properties are you changing for the RasterThumbnailViewer?  I created a sample demo project, and I used the default settings for the RasterThumbnailViewer.  The border size is the same if I set Selected = true or if I click the item.

2.  Since you have SelectionMode set to Multi, it will allow you to select multiple items in the list.  And because you are manually setting the Selected property, you have to manually set it to false.  If you only need one item selected at a time you can set the SelectionMode to Single.  If you need it to be Multi, you can keep track of which items you manually Selected and set them to false once you are done with them.

LEADTOOLS Technical Support
   Report 
  11-06-2008, 13:26
hturnage is not online. Last active: 11/6/2008 6:25:14 PM hturnage

Top 500 Posts
Joined on 01-18-2007
Posts 10
Re: Programmatically select RasterImageListItem in RasterThumbnailBrowser
Reply Quote
I subclassed the RasterThumbnailBrowser and here's a few helper methods I've added to it over time that may help you...

///
///
///
public void MoveNextItem()
{
int currentIndex = SelectedIndex + 1;

ClearSelectedItems();

RasterImageListItem item = Items[currentIndex];

item.Selected = true;
item.Invalidate();

EnsureVisible(currentIndex);
OnSelectedIndexChanged(EventArgs.Empty);
}

///
///
///
public void MovePreviousItem()
{
int currentIndex = SelectedIndex - 1;

ClearSelectedItems();

RasterImageListItem item = Items[currentIndex];

item.Selected = true;
item.Invalidate();

EnsureVisible(currentIndex);
OnSelectedIndexChanged(EventArgs.Empty);
}

///
///
///
///
public void SetCurrentItem(RasterImageListItem item)
{
int currentIndex = this.Items.IndexOf(item);

ClearSelectedItems();

if (item != null)
{
item.Selected = true;
item.Invalidate();

EnsureVisible(currentIndex);
}

OnSelectedIndexChanged(EventArgs.Empty);
}

///
///
///
///
public void SetCurrentIndex(int index)
{
ClearSelectedItems();

if (index != -1)
{
RasterImageListItem item = Items[index];

item.Selected = true;
item.Invalidate();

EnsureVisible(index);
}

OnSelectedIndexChanged(EventArgs.Empty);
}

///
///
///
private void ClearSelectedItems()
{
foreach (RasterImageListItem rasterImageListItem in SelectedItems)
{
if (rasterImageListItem.Selected)
{
rasterImageListItem.Selected = false;
rasterImageListItem.Invalidate();
}
}
}
   Report 
Post
LEAD Support Fo... » Developer » Image Display » Programmatically select RasterImageListItem in RasterThumbnailBrowser

Powered by Community Server, by Telligent Systems