*&---------------------------------------------------------------------*
*& Report ZTEST_CWBK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT ztest_cwbk.
CONSTANTS:
line_length TYPE i VALUE .
DATA: ok_code LIKE sy-ucomm.
DATA:
* Create reference to the custom container
custom_container TYPE REF TO cl_gui_custom_container,
* Create reference to the TextEdit control
editor TYPE REF TO cl_gui_textedit,
repid LIKE sy-repid. * Utillity table to load texts **********************************************************************
TYPES: BEGIN OF t_texttable, line(line_length) TYPE c, END OF t_texttable.
DATA: i_texttable TYPE TABLE OF t_texttable, g_loaded() TYPE c. ********************************************************************** * Impmenting events
**********************************************************************
DATA:
event_type() TYPE c, * Internal table for events that should be registred i_events TYPE cntl_simple_events, * Structure for oneline of the table wa_events TYPE cntl_simple_event.
*---------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------* CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
catch_dblclick FOR EVENT dblclick
OF cl_gui_textedit IMPORTING sender.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION.
METHOD catch_dblclick.
DATA:
from_line TYPE i,
from_pos TYPE i,
to_line TYPE i,
to_pos TYPE i,
wa_texttable TYPE t_texttable.
* event_type = 'Event DBLCLICK raised'.
* Reacting to the system event
call method cl_gui_cfw=>set_new_ok_code
exporting new_code = 'SHOW'.
* Read the position of the double click
CALL METHOD sender->get_selection_pos
IMPORTING
from_line = from_line
from_pos = from_pos
to_line = to_line
to_pos = to_pos.
* table that contains text
IF NOT g_loaded IS INITIAL.
CALL METHOD sender->get_text_as_r3table
IMPORTING table = i_texttable.
* Read the line of the internal table that was clicked
READ TABLE i_texttable INDEX from_line INTO wa_texttable.
IF sy-subrc <> .
EXIT.
ENDIF.
IF wa_texttable+() CS '*'.
SHIFT wa_texttable.
ELSEIF wa_texttable+() NS '*'.
SHIFT wa_texttable RIGHT.
wa_texttable+() = '*'.
ENDIF.
modify i_texttable from wa_texttable index from_line.
* Reload texts from h einternal table
perform load_texts.
ENDIF.
ENDMETHOD. ENDCLASS. START-OF-SELECTION.
SET SCREEN ''.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
DATA str TYPE c.
DATA sline TYPE i.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN .
WHEN 'IMP'.
* event_type = 'System dblclick'.
* perform load_texts.
PERFORM get_texts. "读取文本框到内表
ENDCASE.
* Call the Dispacth method to initiate application event handling
* call method cl_gui_cfw=>Dispatch. ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
IF editor IS INITIAL.
repid = sy-repid.
* Create obejct for custom container
CREATE OBJECT custom_container
EXPORTING
container_name = 'MYCONTAINER1'
EXCEPTIONS
cntl_error =
cntl_system_error =
create_error =
lifetime_error =
lifetime_dynpro_dynpro_link =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Create obejct for the TextEditor control
CREATE OBJECT editor
EXPORTING
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = custom_container
EXCEPTIONS
error_cntl_create =
error_cntl_init =
error_cntl_link =
error_dp_create =
gui_type_not_supported =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. * Link the event handler method to the event and the
* TextEdit control
SET HANDLER lcl_event_handler=>catch_dblclick FOR editor.
* Register the event in the internal table i_events
wa_events-eventid = cl_gui_textedit=>event_double_click.
* wa_events-appl_event = 'X'. "This is an application event
wa_events-appl_event = space. "This is a system event
append wa_events to i_events.
* Pass the table to the TextEdit control using method
* set_registred_events
call method editor->set_registered_events
exporting events = i_events.
ENDIF. ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Form LOAD_TEXTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form LOAD_TEXTS .
TYPES:
BEGIN OF t_texttable,
line(line_length) TYPE c,
END OF t_texttable.
DATA
i_texttable TYPE TABLE OF t_texttable.
* Create internal table with texts
APPEND 'This a method that fills the TextEdit control' TO i_texttable.
APPEND 'with a text.' TO i_texttable.
DO TIMES.
APPEND 'hallo world !' TO i_texttable.
ENDDO.
* Load TextEdit control with texts
CALL METHOD editor->set_text_as_r3table
EXPORTING table = i_texttable.
IF sy-subrc > .
* Display an error message
EXIT.
ENDIF.
* All methods that operates on controls are transferred to the frontend * by a RFC calls. the method FLUSH is used to determine when this is done.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc > .
* Display an error message
ENDIF. endform. " LOAD_TEXTS
*&---------------------------------------------------------------------*
*& Form GET_TEXTS
*&---------------------------------------------------------------------*
form GET_TEXTS .
TYPES:
BEGIN OF t_texttable,
line(line_length) TYPE c,
END OF t_texttable.
DATA
i_texttable TYPE TABLE OF t_texttable. *该方法可以读取编辑文本框输入的内容
CALL METHOD editor->get_text_as_r3table
IMPORTING table = i_texttable. endform. " GET_TEXTS

TEXT文本编辑框4 点击按钮读取文本框内容到内表的更多相关文章

  1. jquery( 点击按钮出来文本框并限制文本框的个数)

    // 首先呢  编辑这个文章  主要是用于和大家的交流  以便学习和交流!! <div class="form-group" id="spots"> ...

  2. js实现点击按钮时显示弹框,点击按钮及弹框以外的区域时隐藏弹框

    转自https://blog.csdn.net/yimawujiang/article/details/86496936 问题:js实现点击按钮时显示弹框,点击按钮及弹框以外的区域时隐藏弹框? 方案一 ...

  3. Py3+PyQt5+Eric6:学习记录之第一天:点击按钮获取文本框的值并输出。

    一.使用qt designer拖拽界面. 使用qtdesigner拖拽界面:

  4. TEXT文本编辑框3 点击按钮添加文本至文本输入框

    In this exercise a function that loads the texts of an internal table into the text window, is imple ...

  5. js中怎么使点击按钮后文本框获得焦点

    <html> <head> <script type="text/javascript"> function setFocus() { docu ...

  6. vue点击按钮复制文本框内容

    1.npm进行安装 npm install clipboard --save 2.在需要使用的组件中import 引用方法:import Clipboard from 'clipboard'; 3.添 ...

  7. Delphi 如何操作外部程序的控件(如按钮,文本框,单选按钮等)

    看你要做什么,比较现在网络很流行的QQ.MSN这些软件都屏蔽了,你可能还可以访问一些小软件的这些控制,思路及方案如下(API函数自己去百度查一下)1.得到你要这个窗口的句柄 使用FindWindow2 ...

  8. 原生 js 实现点击按钮复制文本

    最近遇到一个需求,需要点击按钮,复制 <p> 标签中的文本到剪切板 之前做过复制输入框的内容,原以为差不多,结果发现根本行不通 尝试了各种办法,最后使了个障眼法,实现了下面的效果 一.原理 ...

  9. Jquery禁止/恢复按钮与文本框代码

    最近,加入了一个小项目,由浩哥带领我们几个人一起开发一个东西.幸运的是,我和胡志婷分到了一组,她可是一个具有丰富经验的牛人,对我也很好,哈哈. --背景 说点正事,最近,我们在进行项目的时候,提到了一 ...

随机推荐

  1. BZOJ 1597: [Usaco2008 Mar]土地购买( dp + 斜率优化 )

    既然每块都要买, 那么一块土地被另一块包含就可以不考虑. 先按长排序, 去掉不考虑的土地, 剩下的土地长x递增, 宽y递减 dp(v) = min{ dp(p)+xv*yp+1 } 假设dp(v)由i ...

  2. 【 D3.js 入门系列 — 4 】 如何使用比例尺( scale )

    上一章中使用了一个很重要的概念 — 比例尺( scale ),本节将解说其使用方法. 1. 最大值和最小值 在介绍比例尺( scale )之前,先介绍两个经常和比例尺一起出现的函数,在[第3章]中也出 ...

  3. HDU 3917 最大权闭合图 求最小割

    具体参考http://blog.csdn.net/power721/article/details/6665750 TODO //#pragma comment(linker, "/STAC ...

  4. ios 判断,qq,银行卡,手机号,邮编,生日,数字,字符串,护照, email

    http://blog.csdn.net/dyllove98/article/details/8635079 IdentifierValidator.h // //  IdentifierValida ...

  5. DE1-SOC连接设定

    将电源供应器插上电源接口. 使用白色的USB Type B线材将计算机与DE1-SoC上的USB-Blaster II接口连接.此接口主要负责FPGA配置以及HPS Debug使用. 使用Mini-U ...

  6. Ubuntu服务器上SSH Server 的安装和设置

    网上有很多介绍在Ubuntu下开启SSH服务的文章,但大多数介绍的方法测试后都不太理想,均不能实现远程登录到Ubuntu上,最后分析原因是都没有真正开启ssh-server服务.最终成功的方法如下: ...

  7. WebLech是一个功能强大的Web站点下载与镜像工具

    WebLech是一个功能强大的Web站点下载与镜像工具.它支持按功能需求来下载web站点并能够尽可能模仿标准Web浏览器的行为.WebLech有一个功能控制台并采用多线程操作. http://sour ...

  8. 最简单也最难——如何获取到Android控件的高度

    问题 如何获取一个控件的长和高,相信很多朋友第一眼看见这个问题都会觉得很简单,直接在onCreate里面调用getWidth.getMeasuredWidth不就可以获得了吗,但是,事实上是并没有简单 ...

  9. 安卓开发-Activity中finish() onDestroy() 和System.exit()的区别

    Activity.finish()Call this when your activity is done and should be closed. 在你的activity动作完成的时候,或者Act ...

  10. Eclipse使用技巧总结(二)

    七.快速切换打开的文件 Ctrl + F6 八.快速大写.小写转换 Ctrl + Shift + Y Ctrl + Shift + X 九.快速删除光标所在行 Ctrl + D 十.快速复制 Ctrl ...