ying32 / rust-vcl Goto Github PK
View Code? Open in Web Editor NEWcross-platform rust GUI
License: Apache License 2.0
cross-platform rust GUI
License: Apache License 2.0
Line 18 in 6f360aa
extern "system" -- Usually the same as extern "C", except on Win32, in which case it's "stdcall", or what you should use to link to the Windows API itself
参考:
https://doc.rust-lang.org/reference/items/external-blocks.html#abi
这样的代码会报错
fn OnMouseDown(&self, sender: usize, button: TMouseButton, shift: TShiftState, x: i32, y: i32) {
println!("Button:{}, X:{} Y:{}", button == TMouseButton::mbLeft, x, y);
println!("OnMouseDown");
}
binary operation
==
cannot be applied to typerust_vcl::types::TMouseButton
是不是要加上#[derive(PartialEq, Debug)],方便输出和比较。
MessageDlg("中文", TMsgDlgType::mtInformation, TMsgDlgBtn::mbYes as u32, 0);
这样显示的按钮是OK,TMsgDlgBtn::mbNo
这个才是Yes,另外如果要多个按钮在WIN32里是类似TMsgDlgBtn::mbYes as u32 | TMsgDlgBtn::mbNo as u32
这样的方式么?
其次types.rs
里那些const常量应该加pub吧。
.SetOnLinkClick(sid, |cls: &TMainForm, sender: usize, link: *const c_char, linkType: TSysLinkType|{
println!("link label: {}, type: {:?}", to_RustString!(link), linkType);
});
是不是把to_RustString导出比较好,有些回调参数还是用到*const c_char
了。
pub type TNotifyEvent = fn(usize);
使用这样的定义之后就不能用捕获chk
,类似:
let chk = TCheckBox::new(&self.form);
...
action.SetOnUpdate(|sender: usize|{
let action: TAction = TAction::As(sender);
action.SetEnabled(chk.Checked());
});
会出现:
expected fn pointer, found closure错误。
是否可以改成:
https://stackoverflow.com/questions/57937436/how-to-alias-an-impl-trait
ASLR
,而liblcl没有支持ASLR
,造成使用上有问题,在linker参数中加入/DYNAMICBASE:NO
即可解决。A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.