Frederick Posted July 10, 2019 Share Posted July 10, 2019 I have 4 questions concerning the TUniTreeMenu. 1. How do I change the font size of the items shown in the menu? 2. When I hover the mouse cursor over the tree menu, the cursor changes to a pointer. However, if I click anywhere on the caption, the sub-menu is not shown. I have to click on the arrow key before the sub-menu will show. Is it possible for the sub-menu to show if I click the caption or the arrow key? 3. The tree menu has a SourceMenu property that points to TUniMenuItems component. In each TUniMenuItem sub-menu, I have added code in the OnClick event as follows:- showmessage(TUniMenuItem(Sender).Name); Why is it blank? 4. If I change the above code to showmessage(TUniMenuItem(Sender).Caption); the application crashes with an AV. Why does it happen? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1504) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 10, 2019 Share Posted July 10, 2019 10 hours ago, Frederick said: 2. When I hover the mouse cursor over the tree menu, the cursor changes to a pointer. However, if I click anywhere on the caption, the sub-menu is not shown. I have to click on the arrow key before the sub-menu will show. Is it possible for the sub-menu to show if I click the caption or the arrow key? UniTreeMenu.ExpanderOnly = False Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 10, 2019 Author Share Posted July 10, 2019 4 hours ago, Sherzod said: UniTreeMenu.ExpanderOnly = False Thanks. Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 2, 2022 Author Share Posted March 2, 2022 It has been a while now but may I have the solutions to questions 1) and 3) in the above post? I am currently using UniGUI 1.90.0.1558. Quote Link to comment Share on other sites More sharing options...
Point Posted March 2, 2022 Share Posted March 2, 2022 hi Frederick, If using sourcemenu, Maybe something like this: - To get component name of menu item: procedure TUniForm1.UniTreeMenu1Click(Sender: TObject); var IdxMenuItem: Integer; begin IdxMenuItem := UniTreeMenu1.Selected.Id; ShowMessageN(UniTreeMenu1.SourceMenu.Items[IdxMenuItem].Name); end; - To get caption of menu item: procedure TUniForm1.UniTreeMenu1Click(Sender: TObject); var IdxMenuItem: Integer; begin IdxMenuItem := UniTreeMenu1.Selected.Id; ShowMessageN(UniTreeMenu1.Items[IdxMenuItem].Text); end; Change Font : http://forums.unigui.com/index.php?/topic/10643-unitreemenu-font-size/ http://forums.unigui.com/index.php?/topic/11120-how-to-reduce-fonts-on-unitreemenu/ http://forums.unigui.com/index.php?/topic/12460-tunitreemenu-change-font/ Quote Link to comment Share on other sites More sharing options...
picyka Posted March 2, 2022 Share Posted March 2, 2022 Self.uniTreeMenu.Selected.AttachedMenuItem Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 Hi Point, Thank you for the solutions for getting the TUniMenuItems's name and reducing the font size. They all work. Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 3, 2022 Author Share Posted March 3, 2022 11 hours ago, picyka said: Self.uniTreeMenu.Selected.AttachedMenuItem Thanks. This works as well. 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.