I've had to do exactly this a couple of times myself recently and this
is the soultion i found best.

Let's say in my code i have created a custom control, and it's got an
id of 'myControl'.
I've added it to the map and want to set some CSS styles on it.

function initMyControls(){
 if(document.getElementById('myControl')){
  // the control exists in the DOM and can be manipulated now
 } else {
  // the control does not yet exist
  setTimeout(initMyControls, 1000);
 }
}
// start checking to see if the control exists
initMyControls();

That'll execute until the control exists in the DOM and is ready for
manipulation.

If you have more than one control simply check if that control exists
too:

 if(document.getElementById('myControl') &&
document.getElementById('myOtherControl')){
// etc

And of course you can experiment with different timeout periods to
find what's best.

Martin.




On Dec 15, 6:35 pm, "Anthony (GISCOE)" <[email protected]> wrote:
> I am trying to make a map with some additional controls that align
> with the GMapTypeControl, which comes up with a different width
> depending on the browser. I can get the <div> for the control easily
> enough after it is added (via addControl), but it apparently doesn't
> get populated (i.e. sized) until later.
>
> Is there some event that will tell me when this 'later' is? I can get
> the correct size using a timeout, but not reliably (unless the timeout
> is large). I've tried some of the map events, but nothing seems to
> work properly for this case.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to