zoukankan      html  css  js  c++  java
  • 进阶:案例六: Context Menu(静态 与 动态)

    实现:

    1、add:

     2、delete

    3、add2

    实现步骤:

    1、新建属性display_text

    2、创建layout

    3、代码部分:

    add事件:

    METHOD onactionadd .
      DATA: ls_disp TYPE string.
      wd_context->get_attribute(
       EXPORTING name = 'DISPLAY_TEXT'
         IMPORTING value = ls_disp ).
      CONCATENATE ls_disp 'Action1' into ls_disp.
      wd_Context->SET_ATTRIBUTE( name = 'DISPLAY_TEXT' value = ls_disp ).
    
    ENDMETHOD.

    add2事件:

    method ONACTIONADD2 .
      data: ls_disp type string.
      wd_Context->get_attribute(
      EXPORTING name = 'DISPLAY_TEXT'
        IMPORTING value = ls_disp ).
      CONCATENATE ls_disp 'Action2' into ls_disp.
      wd_Context->SET_ATTRIBUTE( name = 'DISPLAY_TEXT' value = ls_disp ).
    endmethod.

    delete事件:

    method ONACTIONDELETE .
      data: ls_disp type string.
      wd_Context->SET_ATTRIBUTE( name = 'DISPLAY_TEXT' value = space ).
    endmethod.

    方法WDDOONCONTEXTMENU好像没起作用

    method WDDOONCONTEXTMENU .
      DATA: ls_id type string,
            lo_menu type REF TO cl_wd_menu,
            lo_menu_item type REF TO cl_wd_menu_action_item.
    * get the UI element ID
      ls_id = CONTEXT_MENU_EVENT->originator->id.
    * if it is the 1st UI,then assign the Cotext Menu statically
      IF ls_id = 'TEXT'.
        MENU = CONTEXT_MENU_MANAGER->get_context_menu( 'ACTION' ).
        ENDIF.
    * if it is the 2nd UI,then assign the Cotext Menu programly
        IF ls_id = 'TEXT2'.
    **runtime object
          lo_menu = cl_wd_menu=>new_menu( id = 'ACTION2' ).
    **menu itme
          lo_menu_item = cl_wd_menu_action_item=>new_menu_action_item(
          id = 'ADD2'
          on_action = 'ADD2'
          text = 'Action2-Add2' ).
    **add this item to menu
          lo_menu->add_item( lo_menu_item ).
    **menu itme
          lo_menu_item = cl_wd_menu_action_item=>new_menu_action_item(
          id = 'DELETE2'
          on_action = 'DELETE'
          text = 'Action2-DELETE2' ).
    **add this item to menu
          lo_menu->add_item( lo_menu_item ).
    **return the menu
          MENU = lo_menu.
          ENDIF.
    endmethod.
  • 相关阅读:
    org.hibernate.HibernateException: Could not obtain transactionsynchronized Session for current thread
    ajax上传文件
    iphone 图层操作
    什么是OAuth授权
    UIWebView得到加载页的title
    转iphone 动画实现方法
    c#字符串转datatime时,因操作系统不一致产生的问题解决方法
    Bold font in IPhone UILabel
    五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)
    包含iphone4在内的icon,default及图片处理方法
  • 原文地址:https://www.cnblogs.com/caizjian/p/4366314.html
Copyright © 2011-2022 走看看