Jump to content

TUniTreeMenu Questions


Frederick

Recommended Posts

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)
 

TUniTreeMenu Questions.gif

TUniTreeMenu AV If TUniMenuItem Caption Called.png

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 years later...

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/
 

 

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