Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No popup menu in TShockwaveFlash - Problem solved! 2

Status
Not open for further replies.

imagenetics

Programmer
Dec 8, 2003
66
PL
I have finally managed to disable popup menu in TShockwaveFlash component. The solution was in writing a function that responds to right-click message send to an application. Here's the code (green is what you have to write):

In "Unit1.h"
Code:
[b]private:[/b]
[COLOR=green]  [b]void __fastcall[/b] NoRightClick(TMsg &Message, [b]bool[/b] &Handled);[/color]
In "Unit1.cpp"
Code:
[b]__fastcall[/b] TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
[COLOR=green]Application->OnMessage = NoRightClick;[/color]
}
//---------------------------------------------------------------------------
[COLOR=green][b]void __fastcall[/b] TForm1::NoRightClick(TMsg &Msg, [b]bool[/b] &Handled)
{
[b]if[/b]((Msg.message == WM_RBUTTONDOWN) && (Msg.wParam  == MK_RBUTTON)){
 Handled = [b]true[/b];
}[b]else[/b]{
 Handled = [b]false[/b];
}
}[/color]
If you want to popup your own menu (for some reason Popup Menu property in TShockwaveFlash doesn't work) do this:
Code:
[b]void __fastcall[/b] TForm1::NoRightClick(TMsg &Msg, [b]bool[/b] &Handled)
{
[b]if[/b]((Msg.message == WM_RBUTTONDOWN) && (Msg.wParam  == MK_RBUTTON)){
 Handled = [b]true[/b];
 [COLOR=green]POINT cursorPos;
 GetCursorPos(&cursorPos);
 PopupMenu1->Popup(cursorPos.x, cursorPos.y);[/color]
}[b]else[/b]{
 Handled = [b]false[/b];
}
}
 
Don't forget to put this into a FAQ, too.


James P. Cottingham
-----------------------------------------
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top