Comments (23)
我白天也折腾了下x64下,出现几处问题:
在msvc的x64下,有这句的话self.chkListBox.SetParent(self);
,运行就会提示
点击OK后程序正常跑,listboxcustomdraw
也会出现上面的错误,并且运行效果如图:
from rust-vcl.
你只要不使用自绘的样式就没问题的。
from rust-vcl.
我尝试了下,没问题了,感谢
from rust-vcl.
请问下,我试着实现例子里的listview,结果图标的位置很乱:
self.lv2.SetParent(self)
.SetAlign(TAlign::alTop)
.SetReadOnly(true)
.SetRowSelect(true)
.SetViewStyle(TViewStyle::vsIcon)
.SetLargeImages(&self.imgList)
.SetOnClick(sid, |cls: &TMainForm, sender: usize|{
let idx = cls.lv2.ItemIndex();
if idx != -1 {
let item = cls.lv2.Selected();
println!("{}, {}", item.Caption(), item.SubItems().Strings(0));
}
})
// 双击删除选中项
.SetOnDblClick(sid, |cls: &TMainForm, sender: usize|{
let idx = cls.lv2.ItemIndex();
if idx != -1 {
cls.lv2.Items().Delete(idx);
}
});
self.lv2.Items().BeginUpdate();
for i in 0..10 {
self.lv2.Items().Add()
.SetImageIndex(0)
.SetCaption(&format!("{}", i))
.SubItems().Add(&format!("值:{}", i));
}
self.lv2.Items().EndUpdate();
这个问题是啥原因?
还有个问题,按照例子的图片lv3应该是分组,但是代码里看跟lv1差不多,没看到具体哪里是分组的关键代码。
from rust-vcl.
我看了下,那个截图是原来的,这个没更新了,这个他是根据当前宽度计算的,还没有显示,有些值还没生效,加一句
lv2.SetWidth(self.form.Width())
from rust-vcl.
好的 感谢回复。
from rust-vcl.
没注意你还一个问题,分组是原来libvcl所支持的,现在liblcl不支持这个
from rust-vcl.
请教下TMemoryStream在rust中的使用:
let message: [char; 5] = ['h', 'e', 'l', 'l', 'o'];
let mut stream = TMemoryStream::new();
stream.Write(&message as * const char as usize, 5);
println!("{}, {:?}", stream.Position(), stream.ToString());
stream.Free();
这个打印出来是5, "TMemoryStream"?
另外SetPostion的签名是pub fn SetPosition(&self, aValue: *mut i64) -> &Self
我看govcl里直接是int64是否有问题?
还有个小问题,关于
Line 39 in 54f82bc
这里应该如何写比较适合:
// let sid = Application.getSId(); ???
Application.SetOnMinimize(sid, |cls: &TApp, sender: usize|{
})
还有有没有设置活动窗口的API。
from rust-vcl.
- 1、
SetPosition
这个是AST没有生成正确的,明天改改。 - 2、
Write
和Read
方法也要修改下。 - 3、
Application.SetOnMinimize
这个在主窗口里面设置就行了
impl TMainForm {
fn init(&self) -> Self {
let sid = self.getSId();
Application.SetOnMinimize(sid, Self::onAppMinimize);
return &self;
}
fn onAppMinimize(&self, _sender: usize) {
println!("AppMinimize");
}
}
- 4、设置活动窗口的API?哪一种?比如?
from rust-vcl.
哦,对 感谢,比如trayicon在mainFrom.Hide()之后mainFrom.Show()的话窗口还在其他窗口后面不是激活状态,WINAPI的话应该是SetActiveWindow
。
from rust-vcl.
Show之后调用 Application.Restore();
,不过貌似有个问题,位置会变动,还得找找原因
from rust-vcl.
试了,感谢,建议把实例中的i8数组改成char,rust里在x86下char占4个字节,比较有代表性:
let message: [char; 5] = ['h', 'e', 'l', 'l', 'o'];
let mut stream = TMemoryStream::new();
stream.Write(
&message as * const char as usize,
message.len() as i32 * std::mem::size_of::<char>() as i32
);
stream.SetPosition(0);
let mut read_message: [char; 5] = ['\0'; 5];
let len = stream.Read(
&read_message as * const char as usize,
read_message.len() as i32 * std::mem::size_of::<char>() as i32
);
from rust-vcl.
那倒没必要,不过我添加了几个新的方法:
pub fn WriteByte(&self, value: i8) -> i32
pub fn ReadByte(&self) -> i8
pub fn WriteArray<T>(&self, data: &[T]) -> i32
pub fn ReadArray<T>(&self, data: &[T]) -> i32
另外将Write
和Read
方法弄成泛型的了
pub fn Read<T>(&self, buffer: *const T, count: i32) -> i32
pub fn Write<T>(&self, buffer: *const T, count: i32) -> i32
本来想弄个通用的,但是泛型初始值没找到怎么赋值。
from rust-vcl.
感谢。
from rust-vcl.
请教个问题,有没有可能拿到TMainForm里的字段,TApplication::MainForm
取的似乎是TMainForm.form
。
我在实现simpleIM\IMServer的时候协程用的是async_std
,
impl TMainForm {
fn build(&self) {
// ...
async_std::task::spawn(async {
println!("initTCP begin");
initTCP().await;
});
}
}
这里不好捕获self,在之后的initTCP
和newConn
就不容易操作控件,目前我的方法是
let app : &TApplication = &Application;
let inst = app.MainForm().FindChildControl("online").Instance();
println!("{:?}", TLabel::As(inst).Caption());
另外ThreadSync还没有实现好像。
from rust-vcl.
- 1、从Application.MainForm拿不到当前的字段。。。 你看从app的实例拿拿看。。
- 2、
ThreadSync
一直没有好办法,所以暂时搁置状态。
from rust-vcl.
好的,谢谢回复
另外问下TApplication能转成TApp么
from rust-vcl.
不能吧。。。
from rust-vcl.
确实,现在只能用lazy_static了:
struct MyData {
onlineClientCount: Mutex<usize>,
clientMap: Mutex<HashMap<SocketAddr, String>>,
}
lazy_static! {
static ref DATA: MyData = MyData::new();
static ref APP: TApp = TApp::new();
}
from rust-vcl.
Rust中写这些东西感觉限制老大了
from rust-vcl.
设置事件上做了些小修改,移除了getSId
方法,目前直接传self
,如下:
// TButton
self.btn3
.SetParent(self)
.SetLeft(10)
.SetTop(self.btn2.Top() + self.btn2.Height() + 10)
.SetCaption("MsgBox")
.SetOnClick(self, Self::onBtn3Click);
不过不能传&self
哦,因为参数是&T
,传&self
似乎编译器会认为是指针的指针。
from rust-vcl.
好的,感谢提醒 回头我试试。
from rust-vcl.
这个issue太长了,先关了😂
from rust-vcl.
Related Issues (7)
- x86下LNK2019错误 HOT 13
- MessageDlg相关问题 HOT 4
- TNotifyEvent捕获问题 HOT 18
- 类似TMouseButton的enum比较问题 HOT 2
- to_RustString导出 HOT 47
- TTreeView类名不对 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-vcl.