disable the mouse click event sent to swf

.NET Edition of the F-IN-BOX
metal
Posts: 7
Joined: Fri Mar 28, 2008 7:23 am

disable the mouse click event sent to swf

Postby metal » Sat Jun 28, 2008 1:23 am

Is there a way not to pass mouse click event to swf? Here is how I implement the f_in_box__control:

...
this.f_in_box__control1.FlashProperty_WMode = "Transparent";
...
this.f_in_box__control1.TransparentMode = true;
...
this.f_in_box__control1.Click += new System.EventHandler(this.f_in_box__control1_Click);

What I want to do is to handle mouse click at the f_in_box__control level and don't pass it on to the flash.

Thanks,

MF

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Sat Jun 28, 2008 4:39 pm

Thank you for your question.

Create a class (or use application's form) that implements IMessageFilter:

Code: Select all

public class MainForm : System.Windows.Forms.Form, IMessageFilter
{
...
      private const int WM_LBUTTONDOWN = 0x0201;
      private const int WM_LBUTTONUP = 0x0202;
      private const int WM_LBUTTONDBLCLK = 0x0203;

      public bool PreFilterMessage(ref Message m)
      {
         if (m.HWnd == f_in_box__control1.Handle)
         {
            if (WM_LBUTTONUP == m.Msg || WM_LBUTTONDOWN == m.Msg || WM_LBUTTONDBLCLK == m.Msg)
            {
               // Handle the message
               ...
               // return true to not pass the message to f_in_box__control1.
               return true;
            }
         }

         return false;
      }
...
      public MainForm()
      {
...
         Application.AddMessageFilter(this);
      }
...
}


Don't forget to remove filter.

If PreFilterMessage returns true, a message is not passed to a window.

So you should handle WM_LBUTTONDOWN and others inside your filter. And return false to not pass a message to a movie.

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

metal
Posts: 7
Joined: Fri Mar 28, 2008 7:23 am

Postby metal » Sun Jun 29, 2008 11:04 pm

Thanks for the help. It works.


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 5 guests