Archicad C++ API
About Archicad add-on development using the C++ API.

Archicad 24 Browser Control Url Changed Handler Issue

Anonymous
Not applicable
Hello Everyone

I am currently checking out the examples of the SDK 24. I was trying to implement a simple urlChanged handler on the DG::Browser in the BrowserPalette Class. I was working with handlers before in C# but not in C++. When i try to build it I always get an error message.

The goal is it to check the url and if necessary change the url of the browser

Here is the BrowserPalette.hpp Class with my handler function:
public:
...

protected:
virtual void handleURLChanged(const DG::BrowserBase&, DG::BrowserURLChangeArg&);
...

BrowserPalette.cpp:

void BrowserPalette::handleURLChanged(const DG::BrowserBase&, DG::BrowserURLChangeArg&)
{
//change Url
browser.LoadURL("www.abc.com");
};


void BrowserPalette::InitBrowserControl ()
{
browser.LoadURL (siteURL);
RegisterACAPIJavaScriptObject ();
UpdateSelectedElementsOnHTML ();
browser.onUrlChanged += BrowserPalette::handleURLChanged;
}


EventNotifier.hpp
EventNotifier& operator+= (bool (Object::*function)(const Source&, EventArg&));

EventNotifier& operator+= (bool (*function)(const Source&, EventArg&));

template<typename Lambda>
EventNotifier& operator+= (const Lambda& runnable);


Error message while building:
Error C2679 Binary operator "+=": No operator could be found that accepts a right-hand operand of type "overloaded-function" (or no suitable conversion possible)

I tried a lot of different approaches but was not able to make it run therefore I wanted to reach out to the community and ask if someone could help out here.

Thanks a lot, stay healthy and greetings from Switzerland,

Ruka
0 REPLIES 0