TEXT文本编辑框4 点击按钮读取文本框内容到内表
*&---------------------------------------------------------------------*
*& 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 点击按钮读取文本框内容到内表的更多相关文章
- jquery( 点击按钮出来文本框并限制文本框的个数)
// 首先呢 编辑这个文章 主要是用于和大家的交流 以便学习和交流!! <div class="form-group" id="spots"> ...
- js实现点击按钮时显示弹框,点击按钮及弹框以外的区域时隐藏弹框
转自https://blog.csdn.net/yimawujiang/article/details/86496936 问题:js实现点击按钮时显示弹框,点击按钮及弹框以外的区域时隐藏弹框? 方案一 ...
- Py3+PyQt5+Eric6:学习记录之第一天:点击按钮获取文本框的值并输出。
一.使用qt designer拖拽界面. 使用qtdesigner拖拽界面:
- TEXT文本编辑框3 点击按钮添加文本至文本输入框
In this exercise a function that loads the texts of an internal table into the text window, is imple ...
- js中怎么使点击按钮后文本框获得焦点
<html> <head> <script type="text/javascript"> function setFocus() { docu ...
- vue点击按钮复制文本框内容
1.npm进行安装 npm install clipboard --save 2.在需要使用的组件中import 引用方法:import Clipboard from 'clipboard'; 3.添 ...
- Delphi 如何操作外部程序的控件(如按钮,文本框,单选按钮等)
看你要做什么,比较现在网络很流行的QQ.MSN这些软件都屏蔽了,你可能还可以访问一些小软件的这些控制,思路及方案如下(API函数自己去百度查一下)1.得到你要这个窗口的句柄 使用FindWindow2 ...
- 原生 js 实现点击按钮复制文本
最近遇到一个需求,需要点击按钮,复制 <p> 标签中的文本到剪切板 之前做过复制输入框的内容,原以为差不多,结果发现根本行不通 尝试了各种办法,最后使了个障眼法,实现了下面的效果 一.原理 ...
- Jquery禁止/恢复按钮与文本框代码
最近,加入了一个小项目,由浩哥带领我们几个人一起开发一个东西.幸运的是,我和胡志婷分到了一组,她可是一个具有丰富经验的牛人,对我也很好,哈哈. --背景 说点正事,最近,我们在进行项目的时候,提到了一 ...
随机推荐
- 安装centos7注意事项
1,安装centos7注意1和l的区分 2,每一次对/boot/grub2/或者/boot/grub或者/etc/grub/下的文件修改一定要重新编译配置文件sudo grub2-mkconfig - ...
- lnmp-zabbix
wget http://down1.chinaunix.net/distfiles/freetype-2.4.7.tar.bz2 tar -jxvf freetype-2.4.7.tar.bz2 cd ...
- 将 jsp 页面的值 传到struts2 action中(不是表单中的值)
JSP: 页面: <%@ page language="java" pageEncoding="GBK"%> <%@taglib prefi ...
- 说服式设计(persuasive design)的行为模型
转自:http://www.sharetk.com/html/ued/User-Research/1404.html 一 模型简介 BJ Fogg提出了一个新的理解人类行为的模型,他称之为Fogg b ...
- 项目总结SpringMVC+hibernate框架 web.xml 分析(2)
紧接 项目总结SpringMVC+hibernate框架 原理(MVC) applicationContext.xml 文件(3) 这一步讲解项目模块化的配置,项目中每个模块配置一个文件,命名规则为 ...
- 一步一步重写 CodeIgniter 框架 (11) —— 使用 CodeIgniter 函数库
在完成了CI框架的类库扩展后,很自然我们就会想到函数库的扩展.函数库的扩展在 CI 中称为 helper 函数与类有不同的地方,它不能继承,只能覆盖或者添加新的函数,或者直接完全新定义的一组函数. 由 ...
- java中排序一个字符串数组
package test_set_map; import java.util.Arrays; import java.util.Collections; public class Test_Colle ...
- 亚马逊带Marketplace product code的image无法再mount到其他镜像上
这是对已发布镜像的保护么?难道对其进行修改的路彻底断掉了? 以volume形式attach也不行,dd成raw再读取也读不了,敢问路在何方呢 If a volume has an AWS Market ...
- Aizu 1335 Eequal sum sets
Let us consider sets of positive integers less than or equal to n. Note that all elements of a set a ...
- 解决QT Creator在Linux下的输入法问题
https://vjudge1.github.io/2014/04/02/type-chinese-in-linux/http://blog.csdn.net/ubuntutouch/article/ ...