Timothy lam Posted May 4, 2021 Share Posted May 4, 2021 Hi, I'm using the following code to set the icon. But it show the menu text without any icon in TreeView. Am I missing something? if (dm1.cdsMenu.FieldByName('Module_PID').Text = '0') or (dm1.cdsMenu.FieldByName('Module_ID').Text = dm1.cdsMenu.FieldByName('Module_PID').Text) then // add root node begin Node := UniTreeView1.Items.AddChild(nil, dm1.cdsMenu.FieldByName('Module_Name').Text); mainIconFile := Path+'Icons\main.ico'; if FileExists(mainIconFile) then begin mainindex := UniNativeImageList2.AddIconFile(mainIconFile); end else mainindex := -1; Node.ImageIndex := mainindex; end else begin // add child node Index := List.IndexOf(dm1.cdsMenu.FieldByName('Module_PID').Text); Node := UniTreeView1.Items.AddChild(TUniTreeNode(List.Objects[Index]), dm1.cdsMenu.FieldByName('Module_Name').Text); groupIconFile := Path+'Icons\Database.ico'; if FileExists(groupIconFile) then begin grpindex := UniNativeImageList2.AddIconFile(groupIconFile); end else grpindex := -1; Node.ImageIndex := grpindex; end; 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.