-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Cannot call ApplicationViewTitleBar.SetBackgroundColor #2542
Comments
It would super helpful if someone shows me a way to convert my |
This is related to #292 - I'll see if I can find you a workaround for now. |
This requires boxing up the I'd like to warn you now, however, that using |
I will see if I can do a workaround by embedding C++
I am only using |
Today, the |
Note that you can use the The |
How would I do that with |
Here's an example:
use windows::{core::*, Foundation::*, UI::*};
#[implement(IReference<T>, IPropertyValue)]
struct Reference<T>(T)
where
T: RuntimeType + Clone + 'static;
impl<T: RuntimeType + Clone> IReference_Impl<T> for Reference<T> {
fn Value(&self) -> Result<T> {
Ok(self.0.clone())
}
}
impl<T: RuntimeType + Clone> IPropertyValue_Impl for Reference<T> {
fn GetInt16Array(&self, _: &mut Array<i16>) -> Result<()> {
todo!()
}
fn GetUInt16Array(&self, _: &mut Array<u16>) -> Result<()> {
todo!()
}
fn GetInt32Array(&self, _: &mut Array<i32>) -> Result<()> {
todo!()
}
fn GetUInt32Array(&self, _: &mut Array<u32>) -> Result<()> {
todo!()
}
fn GetInt64Array(&self, _: &mut Array<i64>) -> Result<()> {
todo!()
}
fn GetUInt64Array(&self, _: &mut Array<u64>) -> Result<()> {
todo!()
}
fn GetSingleArray(&self, _: &mut Array<f32>) -> Result<()> {
todo!()
}
fn GetDoubleArray(&self, _: &mut Array<f64>) -> Result<()> {
todo!()
}
fn GetChar16Array(&self, _: &mut Array<u16>) -> Result<()> {
todo!()
}
fn GetBooleanArray(&self, _: &mut Array<bool>) -> Result<()> {
todo!()
}
fn GetStringArray(&self, _: &mut Array<HSTRING>) -> Result<()> {
todo!()
}
fn GetInspectableArray(&self, _: &mut Array<IInspectable>) -> Result<()> {
todo!()
}
fn GetGuidArray(&self, _: &mut Array<GUID>) -> Result<()> {
todo!()
}
fn GetDateTimeArray(&self, _: &mut Array<DateTime>) -> Result<()> {
todo!()
}
fn GetTimeSpanArray(&self, _: &mut Array<TimeSpan>) -> Result<()> {
todo!()
}
fn GetPointArray(&self, _: &mut Array<Point>) -> Result<()> {
todo!()
}
fn GetSizeArray(&self, _: &mut Array<Size>) -> Result<()> {
todo!()
}
fn GetRectArray(&self, _: &mut Array<Rect>) -> Result<()> {
todo!()
}
fn GetTimeSpan(&self) -> Result<TimeSpan> {
todo!()
}
fn GetPoint(&self) -> Result<Point> {
todo!()
}
fn GetSize(&self) -> Result<Size> {
todo!()
}
fn GetRect(&self) -> Result<Rect> {
todo!()
}
fn GetUInt8Array(&self, _: &mut Array<u8>) -> Result<()> {
todo!()
}
fn Type(&self) -> Result<PropertyType> {
todo!()
}
fn IsNumericScalar(&self) -> Result<bool> {
todo!()
}
fn GetUInt8(&self) -> Result<u8> {
todo!()
}
fn GetInt16(&self) -> Result<i16> {
todo!()
}
fn GetUInt16(&self) -> Result<u16> {
todo!()
}
fn GetInt32(&self) -> Result<i32> {
todo!()
}
fn GetUInt32(&self) -> Result<u32> {
todo!()
}
fn GetInt64(&self) -> Result<i64> {
todo!()
}
fn GetUInt64(&self) -> Result<u64> {
todo!()
}
fn GetSingle(&self) -> Result<f32> {
todo!()
}
fn GetDouble(&self) -> Result<f64> {
todo!()
}
fn GetChar16(&self) -> Result<u16> {
todo!()
}
fn GetBoolean(&self) -> Result<bool> {
todo!()
}
fn GetString(&self) -> Result<HSTRING> {
todo!()
}
fn GetGuid(&self) -> Result<GUID> {
todo!()
}
fn GetDateTime(&self) -> Result<DateTime> {
todo!()
}
}
fn box_value<T: RuntimeType + Clone>(value: T) -> IReference<T> {
Reference(value).into()
}
fn main() -> Result<()> {
let red = Colors::Red()?;
dbg!(red);
let boxed = box_value(red);
assert_eq!(boxed.Value()?, red);
Ok(())
} Depending on the API you're calling, you may need to implement some of the As you can see, it's a bit involved which is why I'd like to just bake this in to accept |
@kennykerr Thank you soo much! |
Closing as complete for now; workaround above and we're tracking related work via #292. |
Which crate is this about?
windows
Crate version
0.48.0
Summary
There seems to be no way to call ApplicationViewTitleBar.SetBackgroundColor.
Toolchain version/configuration
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\lukax.rustup
installed toolchains
stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc
installed targets for active toolchain
i686-pc-windows-msvc
x86_64-pc-windows-msvc
active toolchain
stable-x86_64-pc-windows-msvc (default)
rustc 1.67.0 (fc594f156 2023-01-24)
Reproducible example
Crate manifest
Expected behavior
The code gets compiled.
Actual behavior
Additional comments
Could not find any other ways to do that. Only thing that worked is
&None
I thinkThe text was updated successfully, but these errors were encountered: