Knowledgebase

status_loader
Die folgenden Inhalte sind nicht auf Deutsch verfügbar.

Scroll item into view

Frage / Problem

How can I navigate to an item so that it is scrolled in to visible area of a control?

This doesn't consistently seem to work by typing the first letters of the element.

Antwort / Lösung

The issue with selecting the element by typing is, that it will only work for elements that have a caption. For performance reasons in the ShellList, loading the caption only occurs when the item is scrolled into view.

However you can force loading the caption sooner by implementing the "OnAddItem" event:

procedure TMainForm.ShellListAddItem(Item: TJamShellListItem;  
var CanAdd: Boolean);
begin  
  Item.Caption := Item.Caption;
end;

In this case the Item.Caption will be assigned when the item is added, so that the incremental search will subsequently work.

Another option to find an item manually, is to use the features that our controls inherited from the TListView control:

var Item := ShellList.FindCaption(0, 'notepad.exe', False, False);
if Assigned(Item) then 
  Item.MakeVisible(False);

If you want to slelect the item, use code like this:

ShellList.SelectedFiles.Add('notepad.exe');

Brauchen Sie weitere Hilfe?

Keine passende Antwort gefunden? Kontaktieren Sie uns, damit wir Ihre Frage beantworten können.

Kontaktformular