picyka Posted April 4, 2022 Share Posted April 4, 2022 class function TMenuUtils.GetNodeByFrame(Menu : TUniTreeMenu; Frame: String): TUniTreeNode; begin Result := nil; var Node := Menu.Items.GetFirstNode; while Node <> nil do begin if (Node.AttachedMenuItem <> nil) and (SameText(Node.AttachedMenuItem.Hint,Frame)) then begin Result := Node; Exit; end; Node := Node.GetNext; end; end; procedure TMainForm.UniComboBoxMenuSelect(Sender: TObject); begin if Self.UniComboBoxMenu.ItemIndex = -1 then Exit; var lMenuItem := TMenuUtils.GetMenu(String(UniComboBoxMenu.Items.Objects[Self.UniComboBoxMenu.ItemIndex])); if Assigned(lMenuItem) then begin try TFrameUtils.ShowFrame(lMenuItem, Self.UniPCMain, nil); var lNode := TMenuUtils.GetNodeByFrame(Self.uniTreeMenu, lMenuItem.Recurso); if lNode <> nil then begin lNode.Font.Style := [TFontStyle.fsBold]; lNode.Parent.Expand(True); end; finally UniComboBoxMenu.Text := ''; end; end; end; Can I change the node font to bold? lNode.Font.Style := [TFontStyle.fsBold]; Quote Link to comment Share on other sites More sharing options...
picyka Posted April 4, 2022 Author Share Posted April 4, 2022 lNode.Text := '<span style="color: red; font-weight: bold;">' + lNode.Text + '</span>'; That solves it. Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted April 4, 2022 Share Posted April 4, 2022 7 hours ago, picyka said: lNode.Text := '<span style="color: red; font-weight: bold;">' + lNode.Text + '</span>'; That solves it. Hello, http://forums.unigui.com/index.php?/topic/10625-change-color-of-tunitreeview-items/&do=findComment&comment=56109 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.