Hi Koen,
> > Oops... the problem is that you cannot manipulate the map before
> > initialize is called. But you also cannot call google.load() multiple
> > times since that loads google's JavaScript multiple times (despite
> > their documentation saying it will not).
> >
> > In our development branch we have added a new method to WWidget,
> > render(), which is useful to defer rendering code until the last
> > moment, which would be useful in this case. But in Wt 2, we do have
> > the undocumented prepareRender() method which can be used here.
> >
> > The version below shows a marker (at your home, I assume?)
>
> The marker is actually the landing zone in front of my home :-)
>
> The maps works now very nicely in the test application.
> But inside my flightlogbook application, it doesn't call
> prepareRerender() at all.
I could reproduce the problem in a small test application, and here is
what I found so far:
If I create the WGoogleMap widget within a slot-function, then the
prepareRender() function will not be called, and thus no map displayed.
Here is a small test that can reproduce the behavior :
class Testapp : public Wt::WApplication
{
public:
Testapp(const Wt::WEnvironment& env) : Wt::WApplication(env)
{
Wt::WBorderLayout *blayout = new Wt::WBorderLayout();
root()->setLayout(blayout);
contw_ = new Wt::WContainerWidget();
blayout->addWidget(contw_, Wt::WBorderLayout::Center);
Wt::WComboBox *cbStatSel = new Wt::WComboBox();
// Wt::Ext::ComboBox *cbStatSel = new Wt::Ext::ComboBox();
cbStatSel->activated.connect(SLOT(this, Testapp::drawMap));
cbStatSel->addItem("Marker");
cbStatSel->addItem("Polyline");
blayout->addWidget(cbStatSel, Wt::WBorderLayout::North);
drawMap(0);
}
virtual ~Testapp() { }
void drawMap(int ind)
{
contw_->clear();
Wt::WGoogleMap *gmap = new Wt::WGoogleMap(contw_);
gmap->resize(700, 500);
if(ind)
{
vector<pair<double, double> > points;
points.push_back(make_pair(47.06354722, 8.647369));
points.push_back(make_pair(47.01887777, 8.651888));
gmap->addPolyline(points, "#FF0000", 2, 0.9);
}
else
gmap->addMarker(std::make_pair(47.01887777, 8.651888));
}
private:
Wt::WContainerWidget *contw_;
};
Rgds
Richard
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest