Jump to content

Problem with search result in TUniTreeMenu


Recommended Posts

I used the same search / filter example from the TreeView Demo for a TUniTreeMenu, but the search result is added to the different TreeView menu which deletes / hides the unseen results see the image and the code used.
What do I need to do to fix this?

Function of Search:

procedure TfrmMainForm.SearchTreeMenu(const AText: string);
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<>'';
      UniTreeMenuPrincipal.BeginUpdate;
      try
        UniTreeMenuPrincipal.ResetData;
        for I := 0 to UniTreeMenuPrincipal.Items.Count - 1 do
        begin
          S := LowerCase( UniTreeMenuPrincipal.Items.Text);
          UniTreeMenuPrincipal.Items.Visible  := (Length(PSString) = 0) or (Pos(PSString, S) >0);
          UniTreeMenuPrincipal.Items.Expanded := aExpand;
        end;
      finally
        UniTreeMenuPrincipal.EndUpdate;
      end;
    end;
  end;
end;
--------------------

CSS used:

/ * UniTreeMenu - ServerModule-->CSS * /

.x-treelist-nav {/ * Here it determines the BACKGROUND COLOR of the menu * /
    background-color: # 414141! important; / * # 32404e; moccasin; * /
    background-position: 24px 0%! important;
    padding: 0 0 0 0;
    overflow: auto! important;
    scrollbar-width: thin; / * scrool style for mozilla * /
    scrollbar-color: # adb3b8 # 516579; / * scrool style for mozilla * /
}

.x-treelist-nav :: - webkit-scrollbar {width: 7px; height: 7px; background: # 516579;}
.x-treelist-nav :: - webkit-scrollbar-track {background: rgba (0,0,0,0,1);}
.x-treelist-nav :: - webkit-scrollbar-thumb {border-radius: 7px; height: 7px; background: # adb3b8;}

 .x-treelist-nav .x-treelist-item-text {
  / * left side menu * /
  color: # adb3b8; / * menu letter color * /
  margin-left: 12px; / * 27 Left-to-right spacing of menu items * /
  margin-right: 26px; / * left-to-right spacing from menu groups * /
  font-size: 12px; / * font size * /
  line-height: 34px; / * height of menu line * /
}

.x-treelist-nav .x-treelist-item-icon: before, .x-treelist-nav .x-treelist-item-tool:
    line-height: 34px; / * 44 is the default * /

}

Thanks in advance for your help.

 

ScreenShot1008.jpg

ScreenShot1006.jpg

ScreenShot1005.jpg

ScreenShot1004.jpg

ScreenShot1003.jpg

Link to comment
Share on other sites

Can you try this on "AdvMainMenu1"

I mean, first "UniTreeMenuPrincipal.SourceMenu:= nil;" then run your filter code on AdvMainMenu1. Then finally reSet "UniTreeMenuPrincipal.SourceMenu:= AdvMainMenu1;"

I can not test on lastunigui sorry, I have 1484.

Link to comment
Share on other sites

  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...