Author Topic: MainMenu ES400  (Read 4146 times)


  • Sr. Member
  • ****
  • Posts: 297
MainMenu ES400
« on: August 04, 2011, 07:20:33 pm »

Using Lazarus- and Lazarus- and Motorola ES400

Having problem with TMainMenu. Have been unable to figure out the problem so will describe the problem here in the hopes that someone here has some insight.

Have a program with multiple forms. Most forms have a menu. Clicking on a menu item sometimes runs system events instead of my onClick code. Typical system events are close form, system pop-up menu appears, or system start menu appears.

For example Form2 has 1 menuItem with three sub menuItems. The middle sub menuItem runs the system event and the other two work as expected. Change the order of the sub items, recompile and the middle item will still be the problem.

Creating a popup menu on the main form that does nothing and recompiling seams to change which items on Form2 will break.

I'm fairly new to mobile development so maybe using multiple forms is the wrong approach.

Lazarus has been a great tool. Heard about it in Aug 2010 and now have a production application in daily use. Now trying to add a mobile component.


  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: MainMenu ES400
« Reply #1 on: August 05, 2011, 01:31:32 pm »
It's a known issue, but one which you can easily work around:


  • Sr. Member
  • ****
  • Posts: 297
Re: MainMenu ES400
« Reply #2 on: August 05, 2011, 06:56:44 pm »
Thank you felipemdc

Now that I know where to look this issue can be handled.

The bug report differs a little from my situation in that this is happening with static menus and not dynamically created menus. Found that the following TMenuItem.command values cause a problem. There may be more.
11 opens a system "New" menu
13 closes the current form
14 opens the system start menu

Here is my workaround for static menu. Since problem command values show up in the same position each compile create menuItems at those positions and set the visibility to false. Each time a TMenuItem is added or removed the non-visible items have to be moved around.

Don't know if it will help or not but here is the MS documentation on WM_COMMAND and WM_SYSCOMMAND. It didn't tell me very much.


TinyPortal © 2005-2018