# CurrentExtentChanged problem

**URL:** <https://community.thinkgeo.com/t/currentextentchanged-problem/397>\
**Category:** WinForms\
**Created:** [May 1, 2009, 3:44am UTC](https://community.thinkgeo.com/t/currentextentchanged-problem/397 "2009-05-01T03:44:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/439d5e/32.png) [@Ricky](https://community.thinkgeo.com/u/Ricky)\
**Post date:** [May 1, 2009, 3:44am UTC](https://community.thinkgeo.com/t/currentextentchanged-problem/397/1 "2009-05-01T03:44:08Z")

</div>

Hi&nbsp;all,

In&nbsp;my&nbsp;CurrentExtentChanged&nbsp;event&nbsp;handler,&nbsp;i&nbsp;have&nbsp;methods&nbsp;to&nbsp;update&nbsp;all&nbsp;the&nbsp;drawings&nbsp;and&nbsp;markers&nbsp;on&nbsp;the&nbsp;map.&nbsp;Everytime&nbsp;the&nbsp;user&nbsp;click&nbsp;and&nbsp;drag&nbsp;the&nbsp;map,&nbsp;the&nbsp;CurrentExtentChanged&nbsp;event&nbsp;fired,&nbsp;and&nbsp;my&nbsp;methods&nbsp;get&nbsp;executed.

This&nbsp;seem&nbsp;ok,&nbsp;but&nbsp;every&nbsp;time&nbsp;it&nbsp;fires,&nbsp;the&nbsp;system&nbsp;looks&nbsp;unresponsive,&nbsp;it&nbsp;was&nbsp;busy&nbsp;doing&nbsp;something.&nbsp;So&nbsp;i&nbsp;use&nbsp;an&nbsp;int&nbsp;to&nbsp;count&nbsp;the&nbsp;number&nbsp;of&nbsp;times&nbsp;it&nbsp;fired:&nbsp;it&nbsp;fired&nbsp;around&nbsp;5-20&nbsp;times,&nbsp;depending&nbsp;on&nbsp;how&nbsp;far&nbsp;you&nbsp;drag&nbsp;the&nbsp;map.&nbsp;It&nbsp;significantly&nbsp;slows&nbsp;down&nbsp;the&nbsp;system.&nbsp;&nbsp;The&nbsp;other&nbsp;one,&nbsp;CurrenScaleChanged&nbsp;did&nbsp;fired&nbsp;correctly,&nbsp;it&nbsp;fires&nbsp;only&nbsp;once&nbsp;for&nbsp;every&nbsp;mousewheel&nbsp;movement.

Is&nbsp;there&nbsp;any&nbsp;way&nbsp;to&nbsp;let&nbsp;the&nbsp;CurrentExtentChanged&nbsp;fire&nbsp;only&nbsp;once&nbsp;when&nbsp;map&nbsp;is&nbsp;dragged?

&nbsp;

Ric

---

<div class="post-metadata">

**Author:** ![Lee](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/l/bc8723/32.png) [@Lee](https://community.thinkgeo.com/u/Lee)\
**Post date:** [May 5, 2009, 6:59am UTC](https://community.thinkgeo.com/t/currentextentchanged-problem/397/2 "2009-05-05T06:59:33Z")

</div>

Ric,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;am&nbsp;afraid&nbsp;you&nbsp;can’t&nbsp;do&nbsp;that&nbsp;in&nbsp;version&nbsp;3.0.199.&nbsp;I&nbsp;have&nbsp;added&nbsp;this&nbsp;to&nbsp;our&nbsp;tracking&nbsp;system&nbsp;to&nbsp;make&nbsp;sure&nbsp;we&nbsp;review&nbsp;it&nbsp;before&nbsp;the&nbsp;next&nbsp;release.&nbsp;  
&nbsp;&nbsp;  
&nbsp;For&nbsp;now&nbsp;you&nbsp;can&nbsp;call&nbsp;your&nbsp;methods&nbsp;when&nbsp;MouseUp&nbsp;event&nbsp;fired.&nbsp;Sorry&nbsp;for&nbsp;the&nbsp;inconveniences.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;ThinkGeo&nbsp;support&nbsp;

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [May 9, 2009, 8:52pm UTC](https://community.thinkgeo.com/t/currentextentchanged-problem/397/3 "2009-05-09T20:52:05Z")

</div>

Ric,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;I&nbsp;feel&nbsp;your&nbsp;pain&nbsp;one&nbsp;this&nbsp;one.&nbsp;&nbsp;We&nbsp;have&nbsp;the&nbsp;same&nbsp;kinds&nbsp;of&nbsp;issues&nbsp;with&nbsp;panning.&nbsp;&nbsp;The&nbsp;problem&nbsp;is&nbsp;that&nbsp;as&nbsp;you&nbsp;are&nbsp;panning&nbsp;the&nbsp;current&nbsp;extent&nbsp;is&nbsp;actually&nbsp;changing.&nbsp;&nbsp;The&nbsp;scale&nbsp;doesn’t&nbsp;change&nbsp;when&nbsp;you&nbsp;pan&nbsp;only&nbsp;if&nbsp;you&nbsp;zoom&nbsp;in&nbsp;or&nbsp;out.&nbsp;&nbsp;If&nbsp;you&nbsp;want&nbsp;to&nbsp;do&nbsp;something&nbsp;on&nbsp;the&nbsp;extent&nbsp;change&nbsp;but&nbsp;do&nbsp;not&nbsp;want&nbsp;to&nbsp;do&nbsp;it&nbsp;on&nbsp;a&nbsp;pan&nbsp;until&nbsp;the&nbsp;extent&nbsp;calms&nbsp;down&nbsp;a&nbsp;bit&nbsp;is&nbsp;to&nbsp;try&nbsp;the&nbsp;following.&nbsp;&nbsp;Create&nbsp;a&nbsp;windows&nbsp;forms&nbsp;timer&nbsp;that&nbsp;is&nbsp;set&nbsp;for&nbsp;maybe&nbsp;one&nbsp;second.&nbsp;&nbsp;Then&nbsp;in&nbsp;put&nbsp;your&nbsp;extent&nbsp;change&nbsp;code&nbsp;in&nbsp;the&nbsp;event&nbsp;of&nbsp;the&nbsp;time.&nbsp;&nbsp;Now&nbsp;the&nbsp;good&nbsp;part,&nbsp;when&nbsp;the&nbsp;extent&nbsp;change&nbsp;is&nbsp;called&nbsp;you&nbsp;check&nbsp;if&nbsp;the&nbsp;timer&nbsp;is&nbsp;running.&nbsp;&nbsp;If&nbsp;it&nbsp;is&nbsp;not&nbsp;running&nbsp;then&nbsp;you&nbsp;start&nbsp;it,&nbsp;if&nbsp;it&nbsp;is&nbsp;running&nbsp;you&nbsp;stop&nbsp;and&nbsp;start&nbsp;it&nbsp;again.&nbsp;&nbsp;This&nbsp;means&nbsp;that&nbsp;while&nbsp;the&nbsp;extent&nbsp;is&nbsp;changing&nbsp;more&nbsp;than&nbsp;once&nbsp;a&nbsp;second&nbsp;the&nbsp;timer&nbsp;will&nbsp;not&nbsp;fire.&nbsp;&nbsp;Once&nbsp;the&nbsp;extent&nbsp;hasn’t&nbsp;change&nbsp;for&nbsp;one&nbsp;second&nbsp;then&nbsp;it&nbsp;will.&nbsp;&nbsp;Make&nbsp;sure&nbsp;to&nbsp;use&nbsp;a&nbsp;Winforms&nbsp;timer&nbsp;and&nbsp;not&nbsp;a&nbsp;threading&nbsp;timer&nbsp;as&nbsp;the&nbsp;Winforms&nbsp;timer&nbsp;integrates&nbsp;well&nbsp;with&nbsp;the&nbsp;UI&nbsp;threading&nbsp;system&nbsp;and&nbsp;will&nbsp;not&nbsp;cause&nbsp;you&nbsp;threading&nbsp;problems&nbsp;that&nbsp;the&nbsp;other&nbsp;timer&nbsp;may.&nbsp;&nbsp;You&nbsp;can&nbsp;play&nbsp;around&nbsp;with&nbsp;the&nbsp;timer&nbsp;time&nbsp;to&nbsp;see&nbsp;what&nbsp;works&nbsp;best.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David
