Skip to content
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

给 HBox 添加 cursortype="hand" 属性,没有效果 #49

Closed
roc1 opened this issue Jun 19, 2019 · 6 comments
Closed

给 HBox 添加 cursortype="hand" 属性,没有效果 #49

roc1 opened this issue Jun 19, 2019 · 6 comments
Labels
question Further information is requested

Comments

@roc1
Copy link

roc1 commented Jun 19, 2019

问题现象

因为想定义一个这样的控件:
<HBox><Control bkimage='icon.png'/><Label /></HBox>
并且想给Label和 icon 都加上 hand cursor,但是不能给 HBox 加。需要分别给每个控件加。
但是icon 和 Label 之间的空隙是 margin 产生的,没办法添加 hand cursor。
虽然空隙也可以定义一个控件,加上 hand cursor,但是这种方式感觉不好。

重现步骤

@roc1
Copy link
Author

roc1 commented Jun 19, 2019

刚刚又试了下,给 HBox 加 cursor 属性是可以的,但是其内部的控件不能继承这个属性。

@nmgwddj
Copy link
Collaborator

nmgwddj commented Jun 19, 2019

@caop3ng 属性不像事件,是没有冒泡或者捕获传播等特性,您还是需要给指定控件单独指定其特有的属性。或可以将不需要响应事件的控件 mouse 属性设置为 false

@nmgwddj nmgwddj closed this as completed Jun 19, 2019
@nmgwddj nmgwddj added the question Further information is requested label Jun 19, 2019
@roc1
Copy link
Author

roc1 commented Jun 19, 2019

@nmgwddj 比如 HBox 里包含多个控件,想给整个 HBox 加上 hand cursor 属性应该只需要给 HBox 加一下就可以了,而不需要每一个子控件分别加上 hand cursor 属性吧?

@nmgwddj
Copy link
Collaborator

nmgwddj commented Jun 19, 2019

@caop3ng 这种情况当鼠标悬浮在子控件中,事件首先会被子控件捕获,子控件是需要单独处理 mouse hover 事件的。

@roc1
Copy link
Author

roc1 commented Jun 19, 2019

@nmgwddj 有没有可能在 build 控件的时候,可以把某一些属性从父亲那里继承下来呢?

@nmgwddj
Copy link
Collaborator

nmgwddj commented Jun 20, 2019

可以重写自己关注的控件增加消息过滤器 AddMessageFilter 来实现类似功能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants