Selecting multiple thumbnails when selectedIndeices set programmatically

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
IntegraHarlan
Posts: 84
Joined: Fri Jan 24, 2020 3:37 am

Selecting multiple thumbnails when selectedIndeices set programmatically

Post by IntegraHarlan »

Hi,
I am setting the thumbnail SelectedIndices to the FocusedIndex. I am doing this on the ThumbnailViewer.FocusedIndexChanged event.
I am doing this so the selected thumbnail will be in sync with the focused image in the viewer as it is scrolled.
This works well except when the document is first loaded.
When the document is loaded the FocusedIndexChanged event is called and the focused index is set to 0. The SelectedIndices is set to the same
index as the focused index.
However if i try to select multiple thumbnails, by pressing shift and clicking on a thumbnail, the index collection is just the selected thumbnail index of the thumbnail i shift-clicked on instead of the selected range of indexes.
If I click on a thumbnail to select it and the shift click on a different thumbnail, I get the expected selected range of indexes.
I would expect that when the first thumbnail is selected when the document is loaded, that I would be able to select multiple thumbnails by using shift-click.
Is there something else I need to do when the SelectedIndices is set when the document is loaded and the firset FocusIndexChanged event is fired?

Here is a sample of the FocusedIndexChanged event.

Code: Select all

private void ThumbnailViewer_FocusedIndexChanged(object sender, FocusedIndexChangedEventArgs e)
{
    ToolbarControl.SetPageLabel(e.FocusedIndex + 1);
    _thumbnailViewer.FocusedIndex = e.FocusedIndex;
    _thumbnailViewer.SelectedIndices.Clear();
    _thumbnailViewer.SelectedIndices.Add(e.FocusedIndex);
}
Thanks
Harlan
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Selecting multiple thumbnails when selectedIndeices set programmatically

Post by Alex »

Hi Harlan,

Please send us (to support@vintasoft.com) a small project, which allows to reproduce the problem. We need to reproduce the problem on our side.

Best regards, Alexander
IntegraHarlan
Posts: 84
Joined: Fri Jan 24, 2020 3:37 am

Re: Selecting multiple thumbnails when selectedIndeices set programmatically

Post by IntegraHarlan »

Hi Alex,
The quickest way to show you this issue to use your sample AnnotationDemo winform project.

I updated the annotationViewer1_ImageLoaded event handler to set the first page as the selected page.
After a multi page pdf file is loaded, it shows the first page as selected. However if I try to multi select by holding down the shift key and clicking on any of the other pages in the thumbnail viewer, the first page will become un-selected and the page I clicked on will show as selected.

If I open a multi page document then click on the first page to select it, then hold the shift key and click on any other page to mulit-select, it will show the page range as selected.

I would like to be able to do the same thing by setting the first page as selected programmatically when the pdf file is loaded, then shift clicking a different page without having to first manually click on the first page to select it.
Here is the updated annotationViewer1_ImageLoaded event handler to reproduce my issue.
Note the last three lines of code in the method:

Code: Select all

/// <summary>
/// Image loading in viewer is finished.
/// </summary>
private void annotationViewer1_ImageLoaded(object sender, ImageLoadedEventArgs e)
{
    _imageLoadingTime = DateTime.Now.Subtract(_imageLoadingStartTime);

    progressBarImageLoading.Visible = false;
    toolStripStatusLabelLoadingImage.Visible = false;


    //
    VintasoftImage image = annotationViewer1.Image;

    // show error message if not critical error occurs during image loading
    string imageLoadingErrorString = "";
    if (image.LoadingError)
        imageLoadingErrorString = string.Format("[{0}] ", image.LoadingErrorString);
    // show information about the image
    imageInfoStatusLabel.Text = string.Format("{0} Width={1}; Height={2}; PixelFormat={3}; Resolution={4}", imageLoadingErrorString, image.Width, image.Height, image.PixelFormat, image.Resolution);

    // if image loading time more than 0
    if (_imageLoadingTime != TimeSpan.Zero)
        // show information about image loading time
        imageInfoStatusLabel.Text = string.Format("[Loading time: {0}ms] {1}", _imageLoadingTime.TotalMilliseconds, imageInfoStatusLabel.Text);

    // if image has annotations
    if (image.Metadata.AnnotationsFormat != AnnotationsFormat.None)
        // show information about format of annotations
        imageInfoStatusLabel.Text = string.Format("[AnnotationsFormat: {0}] {1}", image.Metadata.AnnotationsFormat, imageInfoStatusLabel.Text);


    // update the UI
    UpdateUI();

    // Select the first page.
    thumbnailViewer1.SelectedIndices.Clear();
    thumbnailViewer1.SelectedIndices.Add(0);
    thumbnailViewer1.Invalidate();
}
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Selecting multiple thumbnails when selectedIndeices set programmatically

Post by Alex »

Hi Harlan,

Thank you for information. We reproduced the problem and will improve the thumbnail selection algorithm in ThumbnailViewer class. Improvement will be available in version 9.1, which will be released this month.

Best regards, Alexander
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Selecting multiple thumbnails when selectedIndeices set programmatically

Post by Alex »

Hi Harlan,

Today VintaSoft Imaging .NET SDK 9.1 has been released. In this version we have improved the thumbnail selection algorithm in ThumbnailViewer class and now selection in ThumbnailViewer works like in Explorer. Please use version 9.1 and let me know if you will have any question or problem.

Best regards, Alexander
imarketing21
Posts: 3
Joined: Sat Apr 18, 2020 11:41 pm

Re: Selecting multiple thumbnails when selectedIndeices set programmatically

Post by imarketing21 »

Hello Alex,

Can you please point us to example where selecting multiple thumbnail images has been fixed in the 9.1 version?

Thanks,

Cesar
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Selecting multiple thumbnails when selectedIndeices set programmatically

Post by Alex »

Hello Cesar,
Can you please point us to example where selecting multiple thumbnail images has been fixed in the 9.1 version?
The thumbnail viewer behaviour is impoved if thumbnail selection is changed programmatically.

Please read the third post in this topic if you want to reproduce the problem in version 9.0 and view the fix in version 9.1.

Best regards, Alexander
Post Reply