Jump to content

Unitreemenu fullexpand


d.bernaert

Recommended Posts

21 minutes ago, d.bernaert said:

Can a complete expand and collapse be done another way?

Hi Dominique,

Try this approach:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniTreeMenu1.JSInterface.JSCall('rootItem.getNode().expandChildren', [True]); //expand
  //UniTreeMenu1.JSInterface.JSCall('rootItem.getNode().collapseChildren', [True]); //collapse
end;

 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
On 10/5/2021 at 6:46 AM, Sherzod said:

Hi Dominique,

Try this approach:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniTreeMenu1.JSInterface.JSCall('rootItem.getNode().expandChildren', [True]); //expand
  //UniTreeMenu1.JSInterface.JSCall('rootItem.getNode().collapseChildren', [True]); //collapse
end;

 

I searched but couldn't find a post for my question.

How should I proceed to:

- enable/disable a specific menu item;
- expand a specific menu item;

 

I try with this code:

        for I := 0 to pTreeMenu.Items.Count - 1 do
        begin
          s1 := LowerCase( pTreeMenu.Items[I].Text);
          s2 := LowerCase( pSearch );
          if pSearch = 'dashboards' then
          begin
             pTreeMenu.Items[I].Expanded := true;
             //pTreeMenu.Items[I].Expand( true );
          end;
        end;

Link to comment
Share on other sites

3 hours ago, mikromundo said:

I try with this code:

        for I := 0 to pTreeMenu.Items.Count - 1 do
        begin
          s1 := LowerCase( pTreeMenu.Items[I].Text);
          s2 := LowerCase( pSearch );
          if pSearch = 'dashboards' then
          begin
             pTreeMenu.Items[I].Expanded := true;
             //pTreeMenu.Items[I].Expand( true );
          end;
        end;

Hello,

Works for me. 

Check again, if the search word is correct !? 

Link to comment
Share on other sites

1 hour ago, mikromundo said:

really need help !!!

Looks like there was some confusion in your code...

 

Try this:

procedure TMainForm.UniButton4Click(Sender: TObject);
var
  I: Integer;
  s1, s2, psearch: string;
begin
  psearch := 'dashboard';
  s2 := LowerCase( pSearch );
  
  for I := 0 to UniTreeMenu1.Items.Count - 1 do
  begin
    s1 := LowerCase( UniTreeMenu1.Items[I].Text);
    //if pSearch = 'dashboard' then
    if s1 = s2 then
    begin
       UniTreeMenu1.Items[I].Expanded := False;
       UniTreeMenu1.Items[I].Expanded := True;
       UniTreeMenu1.Items[I].Selected := True;
    end;
  end;
end;

 

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...