spacer
Yehuda Shiran September 8, 2002
Implementing the OnMouseUp Event Handler
Tips: September 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Suppose you want to override the OnMouseUp event within a certain panel of the docking windows application. First, you need to define the new overriding class:

  class ClickPanel extends System.Windows.Forms.Panel {
    override protected function OnMouseUp (e : MouseEventArgs) {
      super.OnMouseUp(e);
      MessageBox.Show("Mouse Up at: "+e.X+", "+ e.Y);
    } 
  } 
Then, you need to change the top panel to behave as the ClickPanel class, instead of the generic Panel class. We first change its definition:

  private var topPanel: ClickPanel;
And then we need to change its construction statement:

  topPanel= new ClickPanel;
You pop up the window by calling the Application.Run() method. If the package name is say MouseUpPkg and the class name is MouseUpCls, the running statement is:

  Application.Run(new MouseUpPkg.MouseUpCls());
Whenever you click inside the top panel, a message box will pop up with the event coordinates, like this:

To learn more about JScript .NET and ASP.NET, go to Column 117, JScript .NET, Part XI: Creating Windows Forms.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Creating a Banking Application Deposit Script · Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
XPath Support for Working with XML Data in MySQL · SSDs Take Center Stage · WebPlus X4 Adds New Features for Easy Site Design