| View previous topic :: View next topic |
| Author |
Message |
jpierce
Joined: 11 Jan 2007 Posts: 23
|
Posted: Wed Oct 01, 2008 9:46 pm Post subject: Problems in context menu related code in TFPC/TTFPC |
|
|
I've been working on a unit to allow Flex to have complex popup menus (without Flash Player Limitations) in f-in-box, and I've run into an issue that I think could use some improvement. In TFlashPlayerControl.WndProc, there is the following code:
| Code: |
if not (csDesigning in ComponentState) then
begin
if (Message.Msg = WM_RBUTTONUP) then
begin
if Assigned(PopupMenu) then
begin
Point.X := Message.LParamLo;
Point.Y := Message.LParamHi;
Point := Self.ClientToScreen(Point);
PopupMenu.Popup(Point.X, Point.Y);
Exit;
end;
end;
|
When you call PopupMenu.Popup like this, it doesn't set PopupComponent. There are also some other things like checking for AutoPopup that are normally done by a TControl.
So instead, I propose this code replace the former:
| Code: |
if (Message.Msg = WM_RBUTTONUP) then
begin
Point.X := Message.LParamLo;
Point.Y := Message.LParamHi;
Point := Self.ClientToScreen(Point);
Message.Result := Perform(WM_CONTEXTMENU, Message.WParam, MakeLParam(Point.X, Point.Y));
Exit;
end;
|
This would allow it to be processed just like a normal context menu click. Don't worry about ComponentState, the TControl checks that.
A similar thing needs to change in TTransparentFlashPlayerControl.ParentWndProc
| Code: |
if ((Message.Msg = WM_KEYDOWN) And (Message.WParam = VK_APPS) And (Not FStandartMenu)) then Exit;
|
By exiting on the VK_APPS key, you prevent being able to use a popup menu with the control that can be brought up with the apps key.
It should change to:
| Code: |
if (Message.Msg = WM_KEYDOWN) And (Message.WParam = VK_APPS) then
if PopupMenu <> nil then
begin
Message.Result := Perform(WM_CONTEXTMENU, Message.WParam, MakeLParam(Word(-1), Word(-1)));
Exit;
end
else if not StandartMenu then
Exit;
|
This allows the underlying context menu event be properly processed.
I'd love to see these changes in the next version or otherwise relatively soon. This is the only thing holding me up from posting my ExternalPopupMenus code. It's some pretty cool code that lets you define and connect popup menus in Flex and have Delphi pop them up. It includes icons and submenus and has no restrictions like always having "About" and "Settings..." menu options. |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1264 Location: Russia, St. Petersburg
|
Posted: Fri Oct 03, 2008 12:01 pm Post subject: |
|
|
Thank you very much for the suggestions. They seems to be correct. So we will include the changes in the nearest release.
Thank you. _________________ Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1264 Location: Russia, St. Petersburg
|
Posted: Wed Nov 19, 2008 7:00 pm Post subject: |
|
|
The fix is included in the new version 3.4.
Thank you! _________________ Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html |
|
| Back to top |
|
 |
jpierce
Joined: 11 Jan 2007 Posts: 23
|
Posted: Wed Nov 19, 2008 7:13 pm Post subject: |
|
|
| Excellent! I'll have to clean up my context menu code and post it now. |
|
| Back to top |
|
 |
|