diff --git a/docs/cookbook/event_navigation/backend.md b/docs/cookbook/event_navigation/backend.md index b78b9316..e3c9289f 100644 --- a/docs/cookbook/event_navigation/backend.md +++ b/docs/cookbook/event_navigation/backend.md @@ -33,12 +33,14 @@ METHOD z2ui5_if_app~main. ENDMETHOD. ``` -If the backend needs more details about the event, use the `t_arg` parameter to add extra info. Three prefixes are available: +If the backend needs more details about the event, use the `arg` parameter to add extra info. Three prefixes are available: - **`$source`** — the UI5 control that fired the event (e.g., `${$source>/text}` returns the button text) - **`$parameters`** — the event parameters defined by the UI5 control (e.g., `${$parameters>/id}` returns the element ID) - **`$event`** — the UI5 event object itself (e.g., `$event>sId` returns the event type like `press`). Note: unlike the other two prefixes, `$event` is written without the `${...}` wrapper and without a leading `/` — see the [Event](#event) section below. +`arg` carries one value, which is what most events need. For two or more, use `t_arg` instead and pass them as a table — ``t_arg = VALUE #( ( `${$source>/text}` ) ( `${$parameters>/id}` ) )`` — and read them back in the same order with `client->get_event_arg( 2 )`, `( 3 )` and so on. The two are the same wire: `arg = x` is exactly ``t_arg = VALUE #( ( x ) )``. + For details, see the [UI5 docs on event handler arguments](https://openui5.hana.ondemand.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe) and sample `Z2UI5_CL_SMP_APP_167`. ## Source @@ -56,9 +58,9 @@ METHOD z2ui5_if_app~main. )->tag( `Button` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` + val = `BUTTON_POST` " reads the button text → result: "post" - t_arg = VALUE #( ( `${$source>/text}` ) ) ) ). + arg = `${$source>/text}` ) ). client->view_display( view->stringify( ) ). @@ -85,9 +87,9 @@ METHOD z2ui5_if_app~main. )->a( n = `id` v = `button_id` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` + val = `BUTTON_POST` " reads the event parameter 'id' → result: "mainView--button_id" - t_arg = VALUE #( ( `${$parameters>/id}` ) ) ) ). + arg = `${$parameters>/id}` ) ). client->view_display( view->stringify( ) ). @@ -113,9 +115,9 @@ METHOD z2ui5_if_app~main. )->tag( `Button` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` + val = `BUTTON_POST` " reads an event-object attribute → result: "press" - t_arg = VALUE #( ( `$event>sId` ) ) ) ). + arg = `$event>sId` ) ). client->view_display( view->stringify( ) ). @@ -157,8 +159,8 @@ CLASS z2ui5_cl_app_hello_world IMPLEMENTATION. )->tag( `Button` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` - t_arg = VALUE #( ( `$` && client->_bind( name ) ) ) ) ). + val = `BUTTON_POST` + arg = `$` && client->_bind( name ) ) ). client->view_display( view->stringify( ) ). diff --git a/docs/cookbook/expert_more/value_help.md b/docs/cookbook/expert_more/value_help.md index 2778b992..79521f02 100644 --- a/docs/cookbook/expert_more/value_help.md +++ b/docs/cookbook/expert_more/value_help.md @@ -116,9 +116,7 @@ CLASS z2ui5_cl_sample_f4 IMPLEMENTATION. )->a( n = `title` v = `{CARRNAME}` )->a( n = `description` v = `{CARRID}` )->a( n = `type` v = `Active` - )->a( n = `press` v = client->_event( - val = `PICK` - t_arg = VALUE #( ( `${CARRID}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `PICK` arg = `${CARRID}` ) ). client->popup_display( popup->stringify( ) ). diff --git a/docs/index.md b/docs/index.md index b92b4b12..7ebf14e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -293,8 +293,7 @@ CLASS zcl_app_invoices IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-10.md b/docs/tutorials/walkthrough/step-10.md index f670c41a..e697c491 100644 --- a/docs/tutorials/walkthrough/step-10.md +++ b/docs/tutorials/walkthrough/step-10.md @@ -76,7 +76,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. METHOD on_event. " get_event( ) holds the name passed to _event( ); - " get_event_arg( ) returns the extra argument attached via t_arg + " get_event_arg( ) returns the extra argument attached via arg CASE client->get_event( ). WHEN `READ`. data_read( ). @@ -177,8 +177,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-12.md b/docs/tutorials/walkthrough/step-12.md index 3ceef166..5d47768f 100644 --- a/docs/tutorials/walkthrough/step-12.md +++ b/docs/tutorials/walkthrough/step-12.md @@ -72,7 +72,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. METHOD on_event. " get_event( ) holds the name passed to _event( ); - " get_event_arg( ) returns the extra argument attached via t_arg + " get_event_arg( ) returns the extra argument attached via arg CASE client->get_event( ). WHEN `READ`. data_read( ). @@ -173,8 +173,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-6.md b/docs/tutorials/walkthrough/step-6.md index f87cdbad..5a54ea6f 100644 --- a/docs/tutorials/walkthrough/step-6.md +++ b/docs/tutorials/walkthrough/step-6.md @@ -59,8 +59,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->a( n = `description` v = `{SUPPLIER}` )->a( n = `info` v = `{QUANTITY}` )->a( n = `type` v = `Active` - )->a( n = `press` v = client->_event( val = `SHOW_INVOICE` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `SHOW_INVOICE` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). @@ -80,11 +79,13 @@ ENDCLASS. - **`type = Active`** makes the whole row clickable and gives it press feedback; the `press` handler sits on the row template, so every row fires the same event. -- **The argument rides with the event:** - ``t_arg = VALUE #( ( `${PRODUCT}` ) )``. The `${...}` syntax is resolved - *per row* in the browser — each clone of the template carries its own - product name. On the server, `client->get_event_arg( )` returns it, and a - table read finds the row. +- **The argument rides with the event:** ``arg = `${PRODUCT}` ``. The + `${...}` syntax is resolved *per row* in the browser — each clone of the + template carries its own product name. On the server, + `client->get_event_arg( )` returns it, and a table read finds the row. + `arg` is the one-value spelling of `t_arg`: it is exactly + ``t_arg = VALUE #( ( `${PRODUCT}` ) )``, and from two values on `t_arg` is + the parameter to use. - **The state is still there.** `t_invoices` was filled in the `check_on_navigated` branch of an earlier roundtrip — the framework restored it before this one, so the event handler can read it. That is the diff --git a/docs/tutorials/walkthrough/step-7.md b/docs/tutorials/walkthrough/step-7.md index c41c92cb..3aa3883f 100644 --- a/docs/tutorials/walkthrough/step-7.md +++ b/docs/tutorials/walkthrough/step-7.md @@ -61,8 +61,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->a( n = `description` v = `{SUPPLIER}` )->a( n = `info` v = `{QUANTITY}` )->a( n = `type` v = `Active` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-9.md b/docs/tutorials/walkthrough/step-9.md index 7aaba909..893a4f66 100644 --- a/docs/tutorials/walkthrough/step-9.md +++ b/docs/tutorials/walkthrough/step-9.md @@ -96,8 +96,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ).