[Fixed] Form in Google Maps InfoWindow issues

What I’m trying to do:
I would like to display an image in a form that is opened in a Google Maps InfoWindow

What I’ve tried and what’s not working:
Issue 1:
Lazy Media are not being displayed in the Form in the InfoWindow

Issue 2:
Secondly, it seems the form or component show events do not fire when the Form is inside the InfoWindow. When I set the source with in the component in the IDE the image renders ok but if I set the source of the image in the init it does not work.

I have confirmed the data being passed to InfoWindow is available in the form (though it is a LazyMedia object) but the image never renders.

Issue 3:
Why are links always surrounded by a black box as if they are preselected? If the link location is moved, sometimes the black box moves to the close x

Code

class InfoWindowForm(InfoWindowFormTemplate):
  def __init__(self, updated_image, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)
    self.updated_image = updated_image
    
    print ("InfoWindow Form init complete")
    self.image_1.source = app_tables.table_1.get(name="Wide Logo")['media']

    # Any code you write here will run when the form opens.

  def form_show(self, **event_args):
    """This method is called when the column panel is shown on the screen"""
    self.image_2.source = self.updated_image
    print ("InfoWindow Form Shown")

Clone link:
Example Link

Clone Link

Secondly, it seems the form or component show events do not fire when the Form is inside the InfoWindow

Ooh, this is very suspicious, because the show event machinery is used by the Image component.

Clone link:
Can mock one up if required

That would be very handy, thank you!

I actually ran into the same issue yesterday.

I fixed it, by setting the source of the Image to the .url attribute of the LazyMedia object.

While this might not be the “correct” solution, it has worked for me, at least until the potential bug is resolved.

I have updated the initial post for ease of reading when looking at the clone link - apologies I should have done this when first posting

I have also added a third issue with InfoWindows regarding links

Thanks for the clone!

for issue 3 - by default the info window is focused when you call its open method.
the open method also takes an options object.

i.open({"map":self.map_1, "shouldFocus": False})

I found this by looking it up in the google map API docs.

Info Window  |  Maps JavaScript API  |  Google Developers


The fact that the show event isn’t firing is the issue for both 1 and 2.
We’ll get that fixed.

1 Like

Thank you @stucork - I will adjust my code to include this.

This should now be fixed

2 Likes

It’s map fun for everyone :grin: