Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
hi
my application is of type Silverlight. i want to trigger when user clicks on the border of the browser. for this purpose, i used this method:
public MainPage()
{
    InitializeComponent();
    bool bResult = System.Windows.Browser.HtmlPage.Window.AttachEvent("onmousedown", new EventHandler(this.eventHandler));
}
 
private void eventHandler(object sender, EventArgs e)
{
    ...
}
but the eventHandler is not called. why?
ps1. if i change "onmousedown" to "onresize" it's called.
ps2. bResult is true in both cases.
Posted 30-Apr-12 2:39am
Edited 30-Apr-12 2:40am
v2
Comments
SAKryukov at 30-Apr-12 18:37pm
   
Why would you contaminate the site with all those numbers in the question titles? If you want, leave them in your own records, with your questions' URLs.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Clicking on the border will not generate an onmousedown event. The border does not belong to browser windows client area so no event will be generated. If you resize the window though, the client area will also change and thus the container for the root element resizes which triggers an onresize event.
 
Hope that clears it up a bit!
 
Cheers!
  Permalink  
Comments
ilostmyid2 at 30-Apr-12 8:20am
   
so how can i grab the mouse events belong to the non-client area parts of the browser?
indeed i need to know when use release the left mouse button (mouse up). by this method i want to know when resize is done.
Manfred R. Bihy at 30-Apr-12 11:58am
   
1. Grabbing non client area mouseevents is IMHO impossible for browser based applications.
2. I'm not sure when a resize event is acutally fired. If the resize is only fired after the mouse button has been released then you'd also have the end of your resize operation. If the resize is being fired continually there is no way I know of to tell that the user finally stopped resizing the window by releasing the mouse button.
ilostmyid2 at 1-May-12 2:56am
   
thank u for ur answer
resize is continually generated.
the fact is that the event might be raised, because we've ResizeEnd in a form application and essentially all windows receive WM_EXITSIZEMOVE and this could not be neglected. this is the fault of MS that it doesn't capture the message and dispatch it throw Silverlight.
but, since the message EXISTS, there must be a way or workaround to write an unmanaged code to capture it.
any suggestion?
SAKryukov at 30-Apr-12 18:35pm
   
That is correct, a 5.
--SA
Manfred R. Bihy at 2-May-12 7:00am
   
Thanks SA!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Afzaal Ahmad Zeeshan 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 30 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100