Welcome! Our Tools - BpBrowser
- BpControl
- BpDownloadUrl
- BpLabel
- BpMarker
- BpMarkerLight
- BpMarkerList
- BpWindow
About Us Licensing Fees Support Contact Us

808-281-3359


BpWindow Reference

Introduction

Download

BpWindows are like infoWindows in that they open on a map position or a marker, and drag with the map. BpWindows can also open outside the map, allowing for larger infoWindows which do not force map movement. A BpWindow can open up, right, left, down, or over (on top of, generally centered on the page) and will automatically find the direction that will allow it to open without extending beyond the edges of the page. If your map is in an iframe, it will open within the parent frame. (This is only true if both frames come from the same server, of course.) You can create as many BpWindows as you like, and have them all open at once. BpWindows can open on BpMarkers, BpMarkerLights, BpLabels and GMarkers.

new BpWindow()

Code:
var win = new BpWindow(map,border?,slop?);


Remarks:

map is, of course, the map to which the BpWindow will belong.
border is the border style of the BpWindow. It defaults to '1px solid black'.
slop, an integer, is the offset required to have the stem line up in IE under certain conditions, in pixels. It defaults to 0. If you need to set it, it'll usually need to be 2.

Examples:

get/setContent()

Code:
var html = win.getContent();
win.setContent(html);


Remarks:

Gets/sets the innerHTML of the content area of the window.

get/setHeight()

Code:
var height = win.getHeight();
win.setHeight(height);


Notes:
  • The argument to win.setHeight() should be an integer, measuring pixels.
  • If the window is open, it will reopen in perhaps another direction.

get/setMarkerTemplate()

Code:
var tmpl = win.getMarkerTemplate();
win.setMarkerTemplate(tmpl);


Remarks:

It's easy to define how a marker will be represented in the window using an HTML template.

The HTML template contains the innerHTML of the div to be created. It is populated with marker-specific information using a special syntax, with information coming from the object returned from marker.getUserData().

If you add "[propertyName]" to your template, it will be replaced with the value of marker.getUserData().propertyName.
If marker.getUserData()[propertyName] is a function, the return value of that function (called as a method of the marker, with propertyName as the only argument) will be the replacement value. To use square brakets without having their contents interpolated, just put at least one space character between them. Only square brackets without spaces inside them will be interpolated, so "markers[ [index] ]" will become (perhaps) "markers[ 42 ]".


Examples:

get/setStemImageUrls()

Code:
var arrayOfUrls = win.getStemImageUrls();
win.setStemImageUrls(ur,ul,ru,rd,lu,ld,dr,dl);


Remarks:

This lets you customize the stem images. The images must be 24x24 pixel pngs. "ur" means up-right which means that the window will open up, with the stem leaning to the right. The rest of the names work similarly.

Notes:
  • It's highly recommended that you pre-fetch the stem images.
  • The stem images must be pngs.
  • The stem images must be 24x24 pixels.
  • arrayOfUrls is an array which holds the same things that are passed to the set method, in that order.

get/setOnOpen/Close()

Code:
var func = win.getOnOpen();
win.setOnOpen(func);
var func = win.getOnClose();
win.setOnClose(func);


Remarks:

Have some functions called as methods of the window object on open or close.

Notes:
  • The functions are called as methods of the window object.
  • Both methods will be called as methods of the BpWindow object, with the window opener passed as the only argument.

getOpener()

Code:
var marker = win.getOpener();


Remarks:

Returns the marker, if any, which was used to open the window.

get/setWidth()

Code:
var width = win.getWidth();
win.setWidth(width);


Notes:
  • The argument to win.setWidth() should be an integer, measuring pixels.
  • If the window is open, it will reopen in perhaps another direction.

isHidden()

Code:
var bool = win.isHidden();



open(), openUp(), openRight(), openLeft(), openDown(), openOver()

Code:
win.open(latlng_or_marker,html,force?);


Remarks:

Opens the window on the map at the specified latlng.
html is the content for the window.
force is optional and false by default. If true, the window will open in the given direction, regardless of the available room.
This is the order in which the window will attempt to open:
  1. up
  2. right
  3. left
  4. down
  5. over

Notes:
  • If there's not enough room to open in a given direction, the next direction is attempted.
  • 'over' means that it will center in the window. If there's not enough room for the BpWindow to open within the current browser client area, then the BpWindow will open with its upper-right corner in the upper-right corner of the browser, so that the close button of the BpWindow is accessible.
  • If a marker is passed as the first argument, its icon must have valid iconAnchor and infoWindowAnchor properties.
  • When the BpWindow opens down, the initial latlng and the icon.infoWindowAnchor values are used to find a reasonable approximate point which will allow the marker to point to the middle of the marker.
  • force is always true for open() and openOver().

Examples:

show/hide()

Code:
win.show()
win.hide()


Remarks:

Show/hide the window.