You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cookbook/browser_interaction/focus.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,22 @@ outline: [2, 4]
3
3
---
4
4
# Focus
5
5
6
+
Read which control currently holds the focus from the backend, or move the focus from the backend to a specific field — both work without any custom control.
7
+
8
+
#### Read the Current Focus
9
+
10
+
`client->get( )-s_focus` tells you which control currently holds the focus and where the caret sits inside it. Useful when an action depends on the field the user was just editing.
11
+
12
+
```abap
13
+
DATA(focus) = client->get( )-s_focus.
14
+
15
+
DATA(id) = focus-id. " id of the focused control
16
+
DATA(selection_start) = focus-selection_start. " caret start, in chars
17
+
DATA(selection_end) = focus-selection_end. " caret end, in chars
18
+
```
19
+
20
+
#### Set the Focus
21
+
6
22
Set the input focus from the backend with the `set_focus` frontend event. Pass the target control's `id` as the first argument — the framework moves the cursor to that field after the next roundtrip.
7
23
8
24
This is useful for guided data entry, barcode scanning, or any flow where the next field to focus depends on backend logic.
Copy file name to clipboardExpand all lines: docs/cookbook/browser_interaction/scrolling.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,27 @@ outline: [2, 4]
3
3
---
4
4
# Scrolling
5
5
6
-
Scroll a control programmatically from the backend with two frontend events:
6
+
Read the current scroll positions from the backend, or scroll a control programmatically from the backend with two frontend events:
7
7
8
8
-**`cs_event-scroll_to`** — scroll a container to a specific pixel position.
9
9
-**`cs_event-scroll_into_view`** — bring a control into the viewport, wherever the surrounding scroll container currently sits.
10
10
11
11
Useful for jump-to-top buttons, restoring positions after navigation, or revealing a row after a backend search.
12
12
13
+
#### Read the Scroll Position
14
+
15
+
`client->get( )-s_scroll` reports the scroll positions of the page and any open dialogs at the moment the event was fired. Each container exposes the id of the scrollable element and its `x` / `y` offsets in pixels.
16
+
17
+
```abap
18
+
DATA(scroll) = client->get( )-s_scroll.
19
+
20
+
DATA(main_y) = scroll-main-y. " main page
21
+
DATA(nest_y) = scroll-nest-y. " first nested view
22
+
DATA(nest2_y) = scroll-nest2-y. " second nested view
23
+
DATA(popup_y) = scroll-popup-y. " open popup
24
+
DATA(popover_y) = scroll-popover-y. " open popover
25
+
```
26
+
13
27
#### Scroll to a Position
14
28
15
29
Pass the control id and the vertical position. Optionally also a horizontal position and a scroll behavior (`auto`, `smooth`, or `instant`):
Copy file name to clipboardExpand all lines: docs/cookbook/device_capabilities/info.md
+3-49Lines changed: 3 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,31 +7,7 @@ abap2UI5 ships the current frontend state with every roundtrip. Read it from `cl
7
7
8
8
#### Device
9
9
10
-
`client->get( )-s_device` describes the user's device and browser: operating system, browser name and version, screen orientation, current viewport size, and capability flags (touch, pointer, retina).
11
-
12
-
```abap
13
-
DATA(device) = client->get( )-s_device.
14
-
15
-
DATA(system) = device-system. " e.g. `desktop`, `phone`, `tablet`
DATA(browser) = device-browser-name. " e.g. `chrome`
19
-
DATA(brw_version) = device-browser-version.
20
-
21
-
DATA(os) = device-os-name. " e.g. `win`, `mac`, `ios`, `android`
22
-
DATA(os_version) = device-os-version.
23
-
24
-
DATA(width) = device-resize-width. " current viewport, in px
25
-
DATA(height) = device-resize-height.
26
-
27
-
DATA(touch) = device-support-touch.
28
-
DATA(pointer) = device-support-pointer.
29
-
DATA(retina) = device-support-retina.
30
-
```
31
-
32
-
::: tip **Bind Directly in the View**
33
-
If you only need device information in the view (not in ABAP logic), bind to the built-in UI5 device model via `{device>/...}` instead — no backend roundtrip required. See [Device Model](../model/device_model.md).
34
-
:::
10
+
For reading device information via `client->get( )-s_device`, see [Device Model](../model/device_model.md).
35
11
36
12
#### UI5
37
13
@@ -48,30 +24,8 @@ DATA(theme) = ui5-theme. " e.g. `sap_horizon`
48
24
49
25
#### Focus
50
26
51
-
`client->get( )-s_focus` tells you which control currently holds the focus and where the caret sits inside it. Useful when an action depends on the field the user was just editing.
52
-
53
-
```abap
54
-
DATA(focus) = client->get( )-s_focus.
55
-
56
-
DATA(id) = focus-id. " id of the focused control
57
-
DATA(selection_start) = focus-selection_start. " caret start, in chars
58
-
DATA(selection_end) = focus-selection_end. " caret end, in chars
59
-
```
60
-
61
-
To move the focus from the backend instead of reading it, see [Focus](../browser_interaction/focus.md).
27
+
For reading the current focus via `client->get( )-s_focus`, see [Focus](../browser_interaction/focus.md).
62
28
63
29
#### Scroll
64
30
65
-
`client->get( )-s_scroll` reports the scroll positions of the page and any open dialogs at the moment the event was fired. Each container exposes the id of the scrollable element and its `x` / `y` offsets in pixels.
66
-
67
-
```abap
68
-
DATA(scroll) = client->get( )-s_scroll.
69
-
70
-
DATA(main_y) = scroll-main-y. " main page
71
-
DATA(nest_y) = scroll-nest-y. " first nested view
72
-
DATA(nest2_y) = scroll-nest2-y. " second nested view
73
-
DATA(popup_y) = scroll-popup-y. " open popup
74
-
DATA(popover_y) = scroll-popover-y. " open popover
75
-
```
76
-
77
-
To scroll from the backend, see [Scrolling](../browser_interaction/scrolling.md).
31
+
For reading scroll positions via `client->get( )-s_scroll`, see [Scrolling](../browser_interaction/scrolling.md).
Copy file name to clipboardExpand all lines: docs/cookbook/model/device_model.md
+15-49Lines changed: 15 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ outline: [2, 4]
3
3
---
4
4
# Device Model
5
5
6
-
abap2UI5 offers two ways to access device information: directly in the view via the UI5 device model (frontend), or by collecting it into ABAP attributes via a custom control (backend).
6
+
abap2UI5 offers two ways to access device information: directly in the view via the UI5 device model (frontend), or in ABAP logic via `client->get( )-s_device` (backend).
7
7
8
8
### Frontend
9
9
@@ -16,58 +16,24 @@ page->input(
16
16
For all parameters, see the [UI5 docs](https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.Device).
17
17
18
18
### Backend
19
-
When you need device information in your ABAP logic (e.g., to adapt behavior based on the browser or screen size), use the `info_frontend` custom control. It collects the values on the frontend and returns them via two-way binding (`_bind_edit`). Once the `finished` event fires, all bound attributes are filled and available to ABAP:
20
-
```abap
21
-
CLASS z2ui5_cl_sample_device DEFINITION PUBLIC.
22
-
23
-
PUBLIC SECTION.
24
-
INTERFACES z2ui5_if_app.
25
-
26
-
DATA ui5_version TYPE string.
27
-
DATA ui5_theme TYPE string.
28
-
DATA ui5_gav TYPE string.
29
-
DATA device_systemtype TYPE string.
30
-
DATA device_os TYPE string.
31
-
DATA device_browser TYPE string.
32
-
DATA check_initialized TYPE abap_bool.
33
-
DATA device_phone TYPE abap_bool.
34
-
DATA device_desktop TYPE abap_bool.
35
-
DATA device_tablet TYPE abap_bool.
36
-
DATA device_combi TYPE abap_bool.
37
-
DATA device_height TYPE string.
38
-
DATA device_width TYPE string.
19
+
When you need device information in your ABAP logic (e.g., to adapt behavior based on the browser or screen size), read it from `client->get( )-s_device` — no custom control, no extra event needed. The value is shipped with every roundtrip:
0 commit comments