Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Can't use implement macro for Application #38

Closed
ZoeyR opened this issue Apr 12, 2022 · 3 comments · Fixed by #39
Closed

Can't use implement macro for Application #38

ZoeyR opened this issue Apr 12, 2022 · 3 comments · Fixed by #39

Comments

@ZoeyR
Copy link

ZoeyR commented Apr 12, 2022

Problem

I am trying to use the implement macro to implement a subclass of Microsoft::UI::Xaml::Application. It produces a build error

error[E0599]: no function or associated item named `new` found for struct `windows_app::Microsoft::UI::Xaml::IApplication_Vtbl` in the current scope
error[E0599]: no function or associated item named `matches` found for struct `windows_app::Microsoft::UI::Xaml::IApplication_Vtbl` in the current scope
@kennykerr
Copy link
Collaborator

I think this is dependent on #37, which ran into a few snags. @riverar

@riverar
Copy link
Collaborator

riverar commented Apr 20, 2022

Sorry to keep you waiting, missed this issue.

Earlier versions of the windows-app crate didn't emit the implement feature (or bring in the upstream windows implement feature). #37 does but I'll pull that out and merge it separately today. Standby.

@riverar
Copy link
Collaborator

riverar commented Apr 21, 2022

@ZoeyR Give that a spin. Let me know if you run into any other issues. There's a new sample too that may be helpful.

#[implement(IApplicationOverrides)]
struct App {
_window: RefCell<Option<Window>>,
}
#[allow(non_snake_case)]
impl App {
fn new() -> windows::core::Result<App> {
let app = App {
_window: RefCell::new(None),
};
Ok(app)
}
}
impl IApplicationOverrides_Impl for App {
fn OnLaunched(&self, _: &Option<LaunchActivatedEventArgs>) -> windows::core::Result<()> {
let window = Window::new()?;
window.SetTitle("WinUI 3 Desktop, Unpackaged (Rust)")?;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants