From c6b619e53ede109b1336338168a342406e657601 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Tue, 27 Jul 2010 11:35:10 +0000 Subject: [PATCH] Fixes wince menus in secondary forms git-svn-id: trunk@26853 - --- lcl/interfaces/wince/wincewsmenus.pp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/wince/wincewsmenus.pp b/lcl/interfaces/wince/wincewsmenus.pp index 7438b6a76d..4db5fe0fa4 100644 --- a/lcl/interfaces/wince/wincewsmenus.pp +++ b/lcl/interfaces/wince/wincewsmenus.pp @@ -137,7 +137,7 @@ var mi: MENUITEMINFO; tb: TBButton; tbbi: TBBUTTONINFO; - i, j, k: integer; + i, j, k, lIndex: integer; buf: array[0..255] of WideChar; R, BR, WR: TRect; LeftMenuCount: Integer = -1; @@ -165,6 +165,12 @@ begin mbi.hwndMB := 0; end;} + // Remove previously installed top-level menu click handlers + if MenuItemsList.Find('1001', lIndex) then + MenuItemsList.Delete(lIndex); + if MenuItemsList.Find('1002', lIndex) then + MenuItemsList.Delete(lIndex); + GetWindowRect(Wnd, BR); // If no menu is currently associated in the application @@ -305,6 +311,7 @@ begin if SendMessage(mbi.hwndMB, TB_SETBUTTONINFO, tbbi.idCommand, LPARAM(@tbbi)) = 0 then DebugLn('[CeSetMenu] TB_SETBUTTONINFO failed'); + // Add to the list to receive click events though WM_COMMAND MenuItemsList.AddObject(IntToStr(tbbi.idCommand), LCLMenu.Items.Items[j]); // Adds subitems to a top-level item @@ -403,6 +410,9 @@ begin if SendMessage(mbi.hwndMB, TB_INSERTBUTTON, i, LPARAM(@tb)) = 0 then DebugLn('TB_INSERTBUTTON failed'); + // Add to the list to receive click events though WM_COMMAND + MenuItemsList.AddObject(IntToStr(tb.idCommand), LCLMenu.Items.Items[j]); + Inc(i); end; end;