mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Add a code snippet for TouchArea.enabled
This commit is contained in:
parent
1c6529d637
commit
764b902957
1 changed files with 25 additions and 0 deletions
|
@ -7,6 +7,7 @@ import SlintProperty from '/src/components/SlintProperty.astro';
|
|||
import PointerEvent from '/src/content/collections/structs/PointerEvent.md';
|
||||
import PointerScrollEvent from '/src/content/collections/structs/PointerScrollEvent.md';
|
||||
import EventResult from '/src/content/collections/enums/EventResult.md';
|
||||
import CodeSnippetMD from '/src/components/CodeSnippetMD.astro';
|
||||
|
||||
|
||||
```slint playground
|
||||
|
@ -46,6 +47,30 @@ When not part of a layout, its width or height default to 100% of the parent ele
|
|||
When disabled, the `TouchArea` doesn't recognize any touch or mouse events and they are
|
||||
passed through to elements underneath.
|
||||
|
||||
<CodeSnippetMD imagePath="/src/assets/generated/basic-syntax.png" scale="2" imageWidth="200" imageHeight="100" imageAlt='Basic syntax'>
|
||||
```slint playground
|
||||
import { Button, CheckBox } from "std-widgets.slint";
|
||||
|
||||
export component Example inherits Window {
|
||||
width: 200px; height: 100px;
|
||||
|
||||
VerticalLayout {
|
||||
Rectangle {
|
||||
Button {
|
||||
text: "Try to press me";
|
||||
}
|
||||
TouchArea {
|
||||
enabled: event-blocker.checked;
|
||||
}
|
||||
}
|
||||
event-blocker := CheckBox {
|
||||
text: "Block Access";
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeSnippetMD>
|
||||
|
||||
:::note{Note}
|
||||
When `enabled` is set to false while the `TouchArea` is pressed, `pointer-event` will be
|
||||
invoked with `PointerEventKind.Cancel`, and the `pressed` and `has-hover` properties will
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue