473,799 Members | 3,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

910209 - Where's ResizeEnd event?

7 New Member
hi
i need to know when resize ends in my Silverlight application. how can i do that?
Apr 28 '12 #1
10 3290
RhysW
70 New Member
Could you not use the FrameworkElemen t.SizeChanged Event? it is called multiple times each time it is resized but is also called for the very last resize event.

This MSDN explanation might be better

Additionally the SizeChanged Event handler may be what you are looking for MSDN link for more information about this one
Apr 30 '12 #2
hamidi
7 New Member
thanx 4 the reply, but i need a way to distinguish between multiple resize events coming and the last one. how can i realize this is the last resize and the user has ended resizing and has released the left mouse button? i need to know when this is triggered. the other resize events is not useful for me. i want to get only one resize event, the last one, every time user resizes the browser window.
Apr 30 '12 #3
RhysW
70 New Member
then the only solution i can think of it storing the size of the form or whatever, and everytime the mousebutton is released check to see if the size is different from the stored values, if it is store the new values for future comparisons and fire the rest of your code, i dont think there is an event that does exactly what you ask so you will have a hard time finding it unless you write something that does it for you. the event you are looking for is very specific and likely to be hard to find,

if you explain Why you need to know when its finished perhaps we can provide an alternative, but with the limited information were given its hard to suggest anything but whats already documeted, which apparently isnt what you need. though i appreciate sometimes you cant give away all your code sometimes its a lot of help to us all to be given an example, even if it is in pseudo code, is there a reason your code should only be fired on the final size changed event? or is it just you being picky about when it is fired?
Apr 30 '12 #4
hamidi
7 New Member
ok, let me explain the reason;
i'm showing a map inside browser. every time size is changed a request is sent to server for new map. it's not still optimized to just return the exposed part to the client. i send the whole image every time a request is received from client. this causes expensive resources to be consumed for nothing, while just the new size is important, the size which user is going to reach by mouse and have to generate several resize events. i want client send the last size to server and update the image at the end of resize.
about ur suggestion, unfortunately it's impractical, because i can't realize when mouse left button is released, because it appears in browser and browser events don't come to Silverlight applications' UserControl and their children.
Apr 30 '12 #5
RhysW
70 New Member
hmm, as i can't find a solution to this and no-one else on the other sites youve posted seems to know, might i make a suggestion to how to do this?

When the user finishes resizing the window you want to fire off and get a new map presumeably to fit in the windows new size correct? but what if the user only moves it a millimeter, perhaps by accident (which i do alot when im moving the mouse about) you arent going to want to send off for a new map then, especially if the map refreshes everytime its sent back the user would lose their location which would annoy them, not something you want for a customer product.

However you could use one of my solutions with a bit of tweaking, use one of the oens that checks if its resized, even if it fires off multiple times, BUT heres the trick, inside that event stick an if statement, ONLY send off for a new map at certain milestone sizes, e.g 1000 by 800px or 250 by 400 px (yes these sizes are stupid but its an example) if one of these milestones is breached send off for the map that will fit inside it, because lets face it if a user does only move the border by a small amount (a mm or 2) adjusting the map to by 2mm larger will hardly make any difference visually, and sending off for a new map thats 1mm larger is just silly if you ask me. (if youre having multiple milestones which i suggest then perhaps use a switch statement instead where CASE is using the length and height, if you just use multiple if statements then 400 x 400 would pass at 100x100 and get a map then pass at 200x200 and get a map then pass at 300x300 and egt a map, there would be three useless map calls, (unless your ifs also checked it was BELOW the next thresh-hold too) just a thought for you, perhaps just temporary until someone finds the proper way of doing it.
Apr 30 '12 #6
hamidi
7 New Member
thank u 4 ur suggestion
as far as i could understand, u mean i change the map size in grids of a value eg. 100 and if map size (width or height) gets different than before more than this value this causes me to send the request, right?
if so, i should choose a value which is not so small and not so big. if the value be large, the map is not got at expected values and if it be small, requests grow.
seems a good suggestion, but i doubt they agree (i work for a company). besides, the users are accurate in missing even such a neglectable margins. they expect when they maximize the browser window they get as large as map they can.
another method which i thought about was using a timer. if in a specified amount of time no resize occurred, then i decide to assume that resize has ended, and then send the request. in another words, i may wait for the new size to get stable. this reduces the number of resize events noticeably. but it's not as good as if i may know when the resize really done.
let's not surrender yet and think about another method i'm thinking about. may this help.
please take a look at:
http://www.codeproject.com/Questions...-not-triggered
just if i may grab "onmouseup" , i may think i've found a solution. don't u think so? :)
Apr 30 '12 #7
RhysW
70 New Member
found you a solution, well, if you are happy with using javascript i have found you a solution! i found an answer on stack overflow, some javascript that uses your idea, it sees if ther is another change in size within 500ms of the last resize event, if not it updates the width and height textbox areas, but im sure you will be able to use it instead to resize the map, here is both a link and the code incase the question is deleted:

Expand|Select|Wrap|Line Numbers
  1. $(window).resize(function() {
  2.     if(this.resizeTO) clearTimeout(this.resizeTO);
  3.     this.resizeTO = setTimeout(function() {
  4.         $(this).trigger('resizeEnd');
  5.     }, 500);
  6. });
  7. You could have this is a base file somewhere, whatever you want to do...then you can bind to that new resizeEnd event you're triggering, like this:
  8.  
  9. $(window).bind('resizeEnd', function() {
  10.     //do something, window hasn't changed size in 500ms
  11. });
all this from Here
Apr 30 '12 #8
hamidi
7 New Member
thanx 4 ur favor,
as i said, timeout is a way like the grid way u suggested which hides unavailability of mouse up event. we will reach there in case we can't really find a solution to grab mouse up on the browser window's border. until then, i prefer not to use timeout and really find out when user releases the mouse left button. the way in the stackoverflow is just a simulation and ResizeEnd is not really received.
so let's concentrate again on the question i posted in codeproject link. someone has answered that this is not the event of the browser window. instead the handler is called because the client area is also resized and this is the client area's event that was raised. if so, there must be a way to access the browser window, its parent. is there a way?
Apr 30 '12 #9
RhysW
70 New Member
according to the link i gave you there isnt a way to know when the browser is finished resizing, because "Remember the event doesn't really start or end, it just "happens" when a resize occurs" this is the logic of browser resizing, it doesnt need to know if the user is finished or not so there is no event for it, so the only way to know is if you write your own method for deciding if a resize is done, and a timer is a way to decide if it is finished or not, unfortunately there isnt a finish clause for the browser resize, it just resizes to co-ordinates repeatedly, think of it this way, when you resize the window it follows the mouse fluidly, not stays still til the mouse is released, because the resize event happens continuously, as there is no resizeend event for a browser


EDIT: read the coments on the timeout answer in stack overflow, many people agree there just is NO end event for resize, YOU have to determine when a resize session has finished

EDIT 2: http://www.quirksmode.org/dom/events/resize.html

this url explains when and how many resize events are triggered in each browser, if youre using win xp you can make each one (cept IE ofc ¬_¬) fire only when finished, but that would be a choice of the user and only for xp, so your timer idea seems to be not just the only way but the best way
Apr 30 '12 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

47
3651
by: Andrey Tatarinov | last post by:
Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable sources. Usage could be something like: >>> res = where: >>> def f(x):
1
1228
by: Anders Both | last post by:
If i write to the event log like this: EventLog.WriteEntry("myPro","Applcation_Starty",EventLogEntryType.Informatio n); Where can i then see a list of thesse event, if i go into the event log in computer management they are not there i think. Do i have to add a new log file or something? ?
3
2437
by: Dan | last post by:
How do I find out what control a DragDrop event comes from? I initially presumed that it was the "sender" parameter. But this always seems to be the destination. Ie ... private void listviewMonday_DragDrop (object sender, System.Windows.Forms.DragEventArgs e) { // "sender" always seems to point to "listviewMonday" here.
4
10704
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to make sure entry is valid? Thanks, Rog
9
2472
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the post event will always execuate after the system is completed... - I want to wrap this functionality in a framework, so I could possibly have 3 or 4 levels of inherited objects that need to have these pre / post events executed before and after the...
5
2167
by: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String) txtAddress.Text = value End Set
5
15284
by: =?Utf-8?B?Um9sYW5kcGlzaA==?= | last post by:
Hi there, I'm using Web Developer Express 2005 in my ASP.NET learning. I tried creating a simple aspx page using "code-behind" approach. I noticed that protected void Page_Load event method appears automatically in mypage.aspx.cs Ok, so far so good, but now I need to code something when Page_Unload occurs but I can't find a place to choose or select Page_Unload event. I'm asking this because I created a mypage2.aspx using "single-file"...
19
3229
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
0
3296
by: xmlmahesh | last post by:
Hi, I have usercontrol I just want to know when user done with his resizing of the control (like ResizeEnd event). I am following below approach is this correct or something else I can do. Can anyone help me to find, where I am going wrong. Since my ResizeControl() is not invoking. But same code works on Win Forms. Please guide me. protected override void WndProc(ref Message m) {
1
2041
by: Noah | last post by:
I'm trying to match against Event.type for KeyPress and ButtonPress. Currently I'm using integer constants (2 and 4). Are these constants defined anywhere? The docs talk about KeyPress and ButtonPress, but I don't see them in any of the Tkinter source files. Are these just magic values that come out of the TK side of things and are not defined in Python? Code like this makes me think I'm doing something wrong: if event.type == 2:...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.