C++ routed event troubles
Posted: 13 Dec 2014, 16:54
I'm trying to follow the documentation for routed events and declare a simple routed event...
But I get this linker error:
Error 215 error LNK2001: unresolved external symbol "public: static class Noesis::Gui::RoutedEvent const * const SBToggleButton::DownloadCompletedEvent" (?DownloadCompletedEvent@SBToggleButton@@2PEBVRoutedEvent@Gui@Noesis@@EB) C:\code\NoesisGUI\NoesisGuiProto\Tutorial05\NoesisGuiExtensions.obj Tutorial05
Any idea what I'm doing wrong?
Thanks.
Code: Select all
NS_DECLARE_SYMBOL(ToggleButtonVisibility)
class SBToggleButton : public Button, public INotifyPropertyChanged
{
public:
SBToggleButton() : _toggleButtonVisibility(Visibility_Visible)
{
}
~SBToggleButton()
{
_destroyedEvent(this);
}
Visibility GetToggleButtonVisibility() const
{
return _toggleButtonVisibility;
}
void SetToggleButtonVisibility(const Visibility toggleButtonVisibility)
{
if (_toggleButtonVisibility != toggleButtonVisibility)
{
_toggleButtonVisibility = toggleButtonVisibility;
_changedEvent(this, NSS(ToggleButtonVisibility));
}
}
PropertyChangedEventHandler& PropertyChanged()
{
return _changedEvent;
}
DestroyedEventHandler& Destroyed()
{
return _destroyedEvent;
}
static const RoutedEvent* DownloadCompletedEvent;
UIElement::Event<RoutedEventHandler> DownloadCompleted()
{
return Event<RoutedEventHandler>(this, DownloadCompletedEvent);
}
protected:
virtual void OnDownloadCompleted(const Ptr<BaseComponent>& downloadedContent)
{
RoutedEventArgs args(this, DownloadCompletedEvent);
RaiseEvent(args);
}
private:
Visibility _toggleButtonVisibility;
PropertyChangedEventHandler _changedEvent;
DestroyedEventHandler _destroyedEvent;
NS_IMPLEMENT_INLINE_REFLECTION(SBToggleButton, Button)
{
NsMeta<TypeId>("SBToggleButton");
NsImpl<INotifyPropertyChanged>();
NsProp("ToggleButtonVisibility", &SBToggleButton::GetToggleButtonVisibility, &SBToggleButton::SetToggleButtonVisibility);
Ptr<UIElementData> data = NsMeta<UIElementData>(TypeOf<SelfClass>());
data->RegisterEvent(DownloadCompletedEvent, "DownloadCompleted", RoutingStrategy_Bubbling);
}
};
Error 215 error LNK2001: unresolved external symbol "public: static class Noesis::Gui::RoutedEvent const * const SBToggleButton::DownloadCompletedEvent" (?DownloadCompletedEvent@SBToggleButton@@2PEBVRoutedEvent@Gui@Noesis@@EB) C:\code\NoesisGUI\NoesisGuiProto\Tutorial05\NoesisGuiExtensions.obj Tutorial05
Any idea what I'm doing wrong?
Thanks.