I really don't understand how Custom Categories are supposed to work in this component. They just don't seem to operate as advertised.
Each category has a category ID, text and imageindex to optionally show an image from the TAdvSmoothListBox
imagelist. An item of the TAdvSmoothListBox can be simply assigned to a category by setting the
item’s CategoryID property. Below is a sample after you apply custom categories.
I have set Categories to custom and they appear correctly, but just don't do anything.
with list_Box.Categories.Add do begin
Text:=group_Name;
ID:=group_ID;
end;
with list_Box.Items.Add do begin
Caption:=item_Name;
Tag:=item_ID;
Level:=0;
CategoryID:=group_ID;
end;
What am I missing here? I am expecting that when I click on the Lookup Bar item it scrolls the List Box to the first occurrence of an item with the same CategoryID. But nothing happens.
- Gerard.
I should mention that CategoryType=alphanumeric does work, but I want to use custom
I found the answer to this. After inspecting the TMS code it appears that the CategoryID value cannot exceed the Categories.Count value. Why is this? The ID should be able to support any value, it's just an ID (not the Index property). There's way to little documentation on this and nothing in the TMS help.
AdvSmoothListBox.pas:
procedure TAdvSmoothListBoxLookUpBar.InitLookupBar;
...
for I := 0 to Fowner.Items.Count - 1 do
begin
with Fowner.Items do
begin
if minl = Level then
begin
S := Caption;
if not Splitter and (S <> '') and Visible then
begin
j := CategoryID;
if (j < FOwner.Categories.Count) and (J > -1) then
FCustomChar[j] := true
end;
end;
end;
end;