• Web Dynpro for ABAP(11):Dialog Boxes


    3.16 Working with Dialog Boxes

    使用弹出框。

    通过接口: IF_WD_WINDOW_MANAGER

    方法:CREATE_POPUP_TO_CONFIRM,创建弹出框。

    注:其中设置窗口大小位置的方法不生效;

    IF_WD_WINDOW~SET_WINDOW_POSITION

    IF_WD_WINDOW~SET_WINDOW_POSITION_CONTROL

    IF_WD_WINDOW~SET_WINDOW_SIZE

    方法:CREATE_POPUP_TO_CONFIRM中参数不生效;

    WINDOW_LEFT_POSITION

    WINDOW_TOP_POSITION

    WINDOW_POSITION

    WINDOW_WIDTH

    WINDOW_HEIGHT

    弹窗在以下UI Elements不生效:

    AcfExecute

    AcfUpDownload

    FlashIsland

    All GAC* controls

    Gantt

    Network

    OfficeControl

    InteractiveForm

    示例:

    Component:DEMO_POPUPS_01

    Component:DEMO_POPUPS_02

    Component: DEMO_POPUPS_03

    使用方法CREATE_WINDOW,创建popup显示自定义window内容;

    创建Component;

    默认Window:V_MAIN;

    默认View:MAIN;

    创建Window: POPUP1_1,popup显示window;

    创建Attributes,M_POPUP1_1,类型:IF_WD_WINDOW;

    实现方法,POPUP显示逻辑

    示例:

    method onactionpopup1_1 .
    
      data: l_cmp_api           type ref to if_wd_component,
       l_window_manager    type ref to if_wd_window_manager.
    l_cmp_api
    = wd_comp_controller->wd_get_api( ). l_window_manager = l_cmp_api->get_window_manager( ). if wd_this->m_popup1_1 is initial. wd_this->m_popup1_1 = l_window_manager->create_window( window_name = 'POPUP1_1' button_kind = if_wd_window=>co_buttons_yesnocancel message_type = if_wd_window=>co_msg_type_question ). endif. wd_this->m_popup1_1->open( ). endmethod.

    Window:POPUP1_1,实现wddoinit方法,绑定按钮响应action

    示例:

    method wddoinit .
    
      data:l_api         type ref to if_wd_view_controller,
        l_window_ctlr type ref to if_wd_window_controller,
        l_popup       type ref to if_wd_window.
    
      l_api         = wd_this->wd_get_api( ).
      l_window_ctlr = l_api->get_embedding_window_ctlr( ).
      if l_window_ctlr is bound.
        l_popup       = l_window_ctlr->get_window( ).
        if l_popup is bound.
          l_popup->subscribe_to_button_event(
                     button            = if_wd_window=>co_button_yes
                     button_text       = 'Yes'                   "#EC *
                     action_name       = 'YES'
                     action_view       = l_api
                     is_default_button = abap_true ).
    
          l_popup->subscribe_to_button_event(
                     button            = if_wd_window=>co_button_no
                     button_text       = 'No'                 "#EC *
                     action_name       = 'NO'
                     action_view       = l_api
                     is_default_button = abap_true ).
    
          l_popup->subscribe_to_button_event(
                     button            = if_wd_window=>co_button_cancel
                     button_text       = 'Cancel'            "#EC *
                     action_name       = 'CANCEL'
                     action_view       = l_api
                     is_default_button = abap_true ).
        endif.
      endif.
    
    endmethod.

    使用方法CREATE_WINDOW_FOR_CMP_USAGE, 使用其他Component的Window作为Popup。

    参数interface_view_name,表示Window名;

    参数component_usage_name,表示使用的component;

    示例:

    method ONACTIONPOPUP2_1 .
    
      data: l_cmp_api           type ref to if_wd_component,
            l_window_manager    type ref to if_wd_window_manager.
    
      l_cmp_api           = wd_comp_controller->wd_get_api( ).
      l_window_manager    = l_cmp_api->get_window_manager( ).
    
      if wd_this->m_popup2_1 is initial.
        wd_this->m_popup2_1 = l_window_manager->CREATE_WINDOW_FOR_CMP_USAGE(
           interface_view_name  = 'MAIN'
           component_usage_name = 'USAGE_POPUP2_1' ).
      endif.
      wd_this->m_popup2_1->open( ).
    
    endmethod.

    使用方法CREATE_POPUP_TO_CONFIRM,生成确认信息弹出框;

    示例:

    method onactionpopup4_1 .
    
      data: l_cmp_api          type ref to if_wd_component,
            l_window_manager   type ref to if_wd_window_manager,
            l_popup            type ref to if_wd_window,
            l_text             type string_table,
            l_api              type ref to if_wd_view_controller.
    
      l_cmp_api        = wd_comp_controller->wd_get_api( ).
      l_window_manager = l_cmp_api->get_window_manager( ).
      insert `Data where changed` into table l_text.    "#EC *
      insert `Do you want to save?`        into table l_text.    "#EC * 
    
      l_popup = l_window_manager->create_popup_to_confirm(
                    text            = l_text
                    button_kind     = if_wd_window=>co_buttons_yesnocancel
                    message_type    = if_wd_window=>co_msg_type_question
                    window_title    = 'Test: Popup to confirm'                window_position = if_wd_window=>co_center )."#EC *
    
      l_api = wd_this->wd_get_api( ).
      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_yes
                   action_name       = 'YES'               action_view       = l_api
                   is_default_button = abap_true ).
    
      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_no
                   action_name       = 'NO'
                   action_view       = l_api
                   is_default_button = abap_false ).
    
      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_cancel
                   action_name       = 'CANCEL'
                   action_view       = l_api
                   is_default_button = abap_false ).
    
      l_popup->open( ).
    
    endmethod.
  • 相关阅读:
    关于路径的小知识点
    转发与重定向
    一种反复的读写文件的方法
    文字排版reportlab
    Qgis中插件的安装位置
    spyder打开文件假死解决
    地图跳跃-超级码力
    尾部的零
    一探torch.nn究竟“What is torch.nn really?”
    KAZE特征和各向异性扩散滤波
  • 原文地址:https://www.cnblogs.com/tangToms/p/16365479.html
Copyright © 2020-2023  润新知