Jump to content

Recommended Posts

  • Moderators

Probably not the most inspiring topic, but just sharing a menu component I needed for some project.

There are quite a few css based menu components around, but I wanted to have a pure smart one.

This one has an unlimited number of submenus and is instantiated as a hamburger menu on a toolbar


  Hamburger := TCHMenu.Create(self);

  //nodes : id,parent,description,procedure
  Hamburger.Add('root','','Hamburger menu');       //root
  Hamburger.Add(  'projects','root','Projects');
  Hamburger.Add(    'project0','projects','New project');
  Hamburger.Add(    'project1','projects','Open project');
  Hamburger.Add(    'project2','projects','Delete project');
  Hamburger.Add(  'designers','root','Designer');
  Hamburger.Add(    'designer0','designers','Domain info',clickproc);   //<== execproc
  Hamburger.Add(    'designer1','designers','Data development');
  Hamburger.Add(    'designer5','designers','Goal Metrics');
//some test cases below
  Hamburger.Add(      'test','project0','test3');            // test level 3
  Hamburger.Add(    'designer5','designers','Goal Metrics');     //test on double entries
  Hamburger.Add(  'test0','root','test',procedure begin writeln('clickproc'); end);  //test on no children
  Hamburger.Add(    'designer6','designers','extra test');       //test on out of order

demo and project files on the .../Menu subdir



Link to post
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.

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