Recent

Author Topic: MainMenu ES400  (Read 4070 times)

goodname

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

Using Lazarus-0.9.30.1-31578-fpc-2.4.4-20110707-cross-arm-wince-win32.exe and Lazarus-0.9.30.1-31578-fpc-2.4.4-20110707-win32.exe 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.

felipemdc

  • 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: http://bugs.freepascal.org/view.php?id=17519

goodname

  • 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.
http://msdn.microsoft.com/en-us/library/aa925729.aspx
http://msdn.microsoft.com/en-us/library/aa930761.aspx