Jump to content

TUniTreeMenu Search


tedeski

Recommended Posts

I need to search for TUniTreeMenu items, in TUniTreeView I use the following function ... already in TUniTreeMenu does not work

 

var
  S, SString : string;
  I : Integer;
  aExpand : Boolean;
begin
  SString := Trim(AText);
  if SString<>PSString then
  begin
    PSString := LowerCase(SString);
    if (Length(PSString) > 1) or (PSString = '') then
    begin
      aExpand := PSString<>'';
      tvmMenu.BeginUpdate;
      try
        tvmMenu.ResetData;
        for I := 0 to tvmMenu.Items.Count - 1 do
        begin
          S := LowerCase(tvmMenu.Items[I].Text);
          tvmMenu.Items[I].Visible := (Length(PSString) = 0) or (Pos(PSString, S)>0);
          tvmMenu.Items[I].Expanded := aExpand;
        end;
      finally
        tvmMenu.EndUpdate;
      end;
    end;
  end;

end;

 

Link to comment
Share on other sites

Its not work like a treeview.

"for I := 0 to tvmMenu.Items.Count - 1 do" This code not accsess to sub items. Counts NOT all items count, just Item's count.
 

for I := 0 to tvmMenu.Items.Count - 1 do
  TMP_item:= tvmMenu.Items[I];
  for J:=0 to TMP_item.items.Count -1 do

Mean need write callback funtion, for chek all items.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...