Recent

Author Topic: ThumbView questions  (Read 5305 times)

sniperton

  • New Member
  • *
  • Posts: 18
ThumbView questions
« on: June 14, 2011, 04:59:53 pm »
Background: I’m a hobby-programmer developing a database application in which records can contain image-references as well. I use ThumbView to display referenced images by passing their URLs to the control’s URLList property. When the user selects a thumbnail, the corresponding image is displayed in large in a Timage control. At the same time the user should be allowed to modify the list of referenced images, so this way ThumbView should serve as a WYSIWYG interface to manipulate the actual record. Here are my questions:

1. On my 32-bit Win7, ThumbView crashes each time a filename contains special characters like “á” or “é”. I pass filenames as a simple string to a TImage (which doesn’t crash) and to a ThumbView (which crashes with an “exception class ‘FPImageException’ with message: File ‘c:\pic\cézanne.jpg’ does not exist”). ThumbView also crashes if it reads files ‘on it’s own’, that is when I only specify the directory. Is this a known bug, and/or is there a workaround for it?

2. As I see ThumbView reads filenames into a StringList which is sorted by default. It’s handy when someone works with complete directories, but can be a burden when someone specifies individual files by their URLs: first because the files are sorted according to their path, rather than their filename; second because I can no more identify which thumbnail belongs to which record entry. Or can I? Or is it possible to easily switch off the sorting feature?

3-4. Two more related questions. The SelectedItem method returns an individual item’s URL as I see, but is there a possibility to access an item from code? (I mean by its index within the URLList, or something like that.) And is it/could it be possible to add an object (a string or an integer) to the URL (like with a TlistBox)?

Thanks for your attention, and thank to theo for this great component,
cheers

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1933
Re: ThumbView questions
« Reply #1 on: June 14, 2011, 07:44:06 pm »
1. Should work now, download again: http://www.theo.ch/lazarus/thumbview.zip
2. Comment calls to fMngr.Sort(0); in the source code (thumbcontrol.pas)
3. You have the source code. Do with it what you like ;-)

For example you can get the Image from mouse-coords like this

Code: Pascal  [Select][+][-]
  1. procedure TForm1.ThumbControl1MouseMove(Sender: TObject; Shift: TShiftState; X,
  2.   Y: Integer);
  3. var itm:TThreadedImage;
  4. begin
  5.  itm:=ThumbControl1.ItemFromPoint(Point(x,y));
  6.  if assigned(itm) then Caption:=itm.URL;
  7. end;

sniperton

  • New Member
  • *
  • Posts: 18
Re: ThumbView questions
« Reply #2 on: June 15, 2011, 03:18:09 pm »
Thanks a lot, theo!  :D

 

TinyPortal © 2005-2018