Re: Vertical Selection in JTextArea
How do I get a vertical selection (i.e. by columns) in a JTextArea? I'm trying to recreate the behaviour of the old DOS 'e' editor or Kate from KDE on Linux.
I would also like to be able to cut copy and paste as colums, rather than rows.
Thanks in Advance.
textComponent.setSelectionStart(int);
textComponent.setSelectionEnd(int);
Similar Messages
-
How to vertical select a text in iWord. Like we do in Mac version of MS Word by Command Option [and selecting]
m0thr4 wrote:
I want to make sure all text in my document is a particular font (at least), but Cmd+a only selects any text that is not in a table. There seems to be no way to include text in tables, or even a way to change the format of all text in a particular table (MS Word allows the whole table to be highlighted for example).
A double click in a cell selects it so you may enter what you wish in it.
Select the cell A1 then, pressing the shift key, click in the right-bottom cell.
Doing that you will get every table's cells selected which gives the ability to apply global attributes.
I've searched the built-in help and found "To select all text in a document, choose Edit > Select All." This does not work as tables are excluded from this selection. If tried some of the other suggestions, such as holding down shift while selecting text in tables, but as soon as I get to the end of the text in one cell, the selection disappears.
My guess is that some words are missing in the Help. Select All selects all the text … of the text layer.
We must apply the settings to the text layer, to each text box, to each table.
Of course, you may _Go to "Provide Pages Feedback" in the "Pages" menu_, describe what you wish.
Then, cross your fingers, and wait _at least_ for iWork'09
Yvan KOENIG (from FRANCE vendredi 10 octobre 2008 17:16:06) -
Vertical selection problem in sqlserver editor
vertical selection of content (shift+alt+arrows) is not working properly in sql server editor.
For rectangular selection areas, it's ALT and drag the mouse, not ALT and Arrow movement. Rectangular selection areas are fantastic, you can use for copying, but also for deleting, and for typing. And for "Execute selected" via
F5 or however you like to do it.
For example, if you forgot to put apostrophes around text, and the columns are all lined up, create a zero-width but tall rectangular selection area, and you can add in the leading apostrophe, then repeat, close the apostrophe, the change applies to
each line in the selection.
EDIT: Notepad++ has the shift-alt-arrow rectangular selection feature (I just tried it, can't say I had ever noticed it before). Also, my apologies fore repeating answers, that's what you get when you look at the forums on a phone! ;-) -
Can I define a vertical SELECTION-SCREEN block ?
Hi, I started getting to know the SELECTION-SCREEN statements now, I was wondering if there's a way to define a vertical screen block instead of an horizontal one.
Also, can I set the size of a given block ? Let's say I don't want it to extend to the right margin of the screen. Can I limit it to the middle, for instance ?
Here's a code excerpt so you can understand a little what I'm intending to do (I want to place the operators vertically on the screen).
SELECTION-SCREEN BEGIN OF BLOCK BOX1 WITH FRAME TITLE S_TBOX1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 20(10) S_COMM.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK BOX2 WITH FRAME TITLE S_TBOX2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB1 USER-COMMAND 'XXX'.
SELECTION-SCREEN PUSHBUTTON (3) S_PB2 USER-COMMAND 'XXX'.
SELECTION-SCREEN PUSHBUTTON (3) S_PB3 USER-COMMAND 'XXX'.
SELECTION-SCREEN PUSHBUTTON (3) S_PB4 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BOX2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB5 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BOX1.
INITIALIZATION.
S_COMM = 'CALCULATOR'.Ok, I thought of that but... now I need the answer for the 2nd question I posted: is it possible to limit the extension of the block, so it ends right after the 4 buttons column ?
SELECTION-SCREEN BEGIN OF BLOCK BOX1 WITH FRAME TITLE S_TBOX1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 20(10) S_COMM.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK BOX2 WITH FRAME TITLE S_TBOX2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB1 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB2 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB3 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB4 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BOX2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (3) S_PB5 USER-COMMAND 'XXX'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BOX1.
INITIALIZATION.
S_COMM = 'CALCULATOR'. -
Can I center the text in vertical direction in JTextArea
for example , if the JTextArea is 50 pixels high, and the text 's height is 20 pixels,
then how can I center the text in vertical direction in this JTextArea which means
there is a extra space whose height is 15 pixels over and under the text?Exactly what are you trying to do?
JTextAreas are usually in a scroll pane, you add multiple lines ie height can change
are you going to make it uneditable etc
if it is just for a display (uneditable), perhaps a 'tall' JTextField might give you the desired effect -
Hi,
I was wondering if there is anything built-in to Swing to implement a block selection in a text area.
I understand that the concept of block selection is really only applicable when a fixed-width font is used. and since the text is represented as a flow of characters, the concept of block selection might not be readily available.
If anyone know of any ways this can be done that will be great. Thank for your help in advance.
Kit
PS. In case it is not clear what block selection is, think of the selection behavior in Excel.You can implement KeyListener where use similar approach.
best regards
Stas
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
public class TestPopup
JFrame frame;
public static void main(String args[])
new TestPopup();
public TestPopup()
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextArea ta=new JTextArea("test11111\ntest22222\ntest33333\ntest44444\ntest55555\n");
try {
ta.getHighlighter().addHighlight(14,17,((DefaultHighlighter)ta.getHighlighter()).DefaultPainter);
ta.getHighlighter().addHighlight(24,27,((DefaultHighlighter)ta.getHighlighter()).DefaultPainter);
ta.getHighlighter().addHighlight(34,37,((DefaultHighlighter)ta.getHighlighter()).DefaultPainter);
catch (Exception ex) {
ex.printStackTrace();
JScrollPane scroll=new JScrollPane(ta);
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(scroll,BorderLayout.CENTER);
frame.setSize(300,200);
frame.setVisible(true); -
Hi all,
I want to select a part of the words in my JTextArea. But not with the mouse, my programm has to select. I use the method select(int, int) from javax.swing.text.JTextComponent. It works, becouse if I make cut selection the part will be cut. But I also want to SEE what is selected, like it looks like when i select something with the mouse.
What can I do?
THX
foxytextComponent.setSelectionStart(int);
textComponent.setSelectionEnd(int); -
About select() in JTextArea?
i wrote the following codes,but the select() didnt work, :( why?
could you help me?please....
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class TrySelect {
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame frame = new JFrame("TrySelect");
Container c = frame.getContentPane();
final JTextArea t= new JTextArea();
c.add(t);
JButton b = new JButton("Select");
c.add(b,BorderLayout.SOUTH);
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
t.select(5, 10);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(120, 200,400,500);
frame.setVisible(true);
thanks a lot!If the problem exactly is to get the data from the TextArea you have to use "getText()".
Also mention number of rows and columns that the TextArea should contain while defining Text Area.
JTextArea t = new JTextArea(5,10);
This statement creates the TextArea with 5 rows and 10 cols.
In order to get the data entered in the TextArea when the button pressed, use the following statement in "actionPerformed()".
String str = t.getText(); -
Vertical Text Selection (InDesign)
I've been trying to look for information to help me select text vertically in InDesign unsuccessfully. I know Microsoft Word can do it, is there a way to select text vertically in InDesign? Perhaps using a script? I use InDesign CS1 on a Mac G4. Any help would be greatly appreciated.
Thanks a lot,
MThere may be some sort of clumsy and tedious way to do it with the help of Word:
You could copy your text to a Word document, then do to it whatever can be done in order to make the text flow and line breaks etc match the appearance it has in InDesign. Then do the vertical selection. Give some significant new attribute to the selection, like another typeface.
Save the Word document and place it to that text box in InDesign where it actually came from. Do a search&replace looking for the new "alien" typeface, replacing it by the original one plus doing to it what you actually wanted to do with it ...
Well, as I said: clumsy and tedious
Klaus -
Having made the transition from Word to ID CS4, one of the things I miss most is the ability to select multiple text instances (by holding down Ctrl as you select them with the mouse).
Or is this possible in ID CS4 via an alternative route?Are you telling me it may be time to upgrade my copy of Word?
Actually, I think you're being mislead somewhat.
Let's be clear:
In Word 2003 and 2007, you can "mouse-select" text within multiple text boxes, (holding down Ctrl).
In Word as far back as I can remember, (and I'm not young), you could always hold down Alt while drag-selecting to make a vertical selection, (described earlier in this thread as selecting bullet characters only). Very handy when cleaning up someone else's tab disaster.
In Word, you CANNOT select dis-contiguous text that all resides on the same open page. At least I have yet to do it.
In ID, you indeed CAN Pick-Tool select multiple text frames and apply a single paragraph style to all. -
Is there a way to isolate a particular key framed value for multiple layers? I have a glow effect on multiple layers and I want to select the keyframe of that effect for all of the layers, however when I hit U it shows some other values like Opacity and Scale that I animated but I don't want to edit. When I hit T or S, it isolates those values, but is there some way to hide those values after hitting U?
Images:
When I hit U, I get all of the animetd attributes of the layers:
I just want to edit the glow intensities for 11 differnt layers at once (by vertically selecting them), but I cant select those keyframes (far right) without selecting Opacity and scale keyframes.Hold down Shift when hitting T, S and whatever keys to add/ subtract them from a current view.
Mylenium -
Datagrid: Vertical Rows instead of Horizontal Rows
Hi,
Usually, inside a datagrid there are rows and columns.
The rows shows ex. one product for each line. Each product has some properties like number, color, weight,...
What we wanted to do is not to show one product per line, but 1 product per column: --> see the example
Normal Datagrid:
Number Description Color Weight ...
1 Product 1 red 10 kg
2 Product 2 green 15 kg
3 Product 3 blue 5 kg
What we want is:
Number 1 2 3
Description Product 1 Product 2 Product 3
Color red green blue
Weight 10 kg 15 kg 5 kg
Possible to do with standard Flex SDK?
Did anyone write such a component already with Flex 3 or Flex 4?
Thanks for any help on that issue.A pivot table is something else...
To change the datasource is possible, but the result is not what is correct.
cause:
- The selection of one product must be a vertical selection, and not a horizontal one.
- The column header must be at the left side, and not at the top!
But yes, sure, everything is possible to develop....
thanks anyway :-) -
Calculating the length of the longest side of a polygon
If you want to calculate the length of the longest side of a polygon -- for example a rectangle -- how can that be done using the standard geometrical functions of spatial in an oracle 10g2 database?
SDO_LENGHT delivers the outline of the polygon. If have looked at the LRS functions, but could not come up with a combination that delivers me what I am looking for. Any suggestion is appreciated.What do you see as the longest side?
Is that the longest stretch between 2 consecutive vertices?
If this is the case, this sql could be of help, which could need maybe some optimisation and extension (calculates straigth distance between 2 consecutive vertices).
select id, p_side_nr, p_side, p_side_length
from
select id, p_side_nr, p_side, sdo_geom.sdo_length(p_side, 0.005) p_side_length, max(sdo_geom.sdo_length(p_side, 0.005)) over (partition by id) max_p_side_length
from
select id, p_side_nr,
sdo_geometry(2002, NULL, NULL,
SDO_ELEM_INFO_ARRAY(1,2,1),
SDO_ORDINATE_ARRAY(startx, starty, endx, endy)
) p_side
from
select
startp.id, startp.x startx, startp.y starty, startp.v_id p_side_nr, endp.x endx, endp.y endy, endp.v_id
from
select s.id, t.id v_id, t.x, t.y
from your_table_name s, table(sdo_util.getvertices(geometry)) t
) startp
select s.id, t.id v_id, t.x, t.y
from your_table_name s, table(sdo_util.getvertices(geometry)) t
) endp
where startp.id = endp.id
and startp.v_id = endp.v_id - 1
) where p_side_length = max_p_side_lengthif you do not need the geometry of that longest side, you could follow Ivan's suggestion as a shortcut by using Pythagoras.
Edited by: lucvanlinden on Sep 2, 2008 7:48 PM -
Checkbox cant be updated in ALV Grid
Hi in my requirement, ALV Grid contains checkbox, when I check that, the internal table for checkbox is not updated.
In code I am writting:
Final Internal Tbale:
Data: BEGIN OF T_FINAL occurs 0,
CHK_BOX,
END OF T_FINAL.
LS_FIELDCAT-TABNAME = t_final.
LS_FIELDCAT-COL_POS = 1.
LS_FIELDCAT-FIELDNAME = 'CHK_BOX'.
LS_FIELDCAT-SELTEXT_S = check box.
LS_FIELDCAT-INPUT = 'X'.
LS_FIELDCAT-OUTPUTLEN = 1.
LS_FIELDCAT-CHECKBOX = 'X'.
LS_FIELDCAT-EDIT = 'X'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
CLEAR LS_FIELDCAT.
DATA: I_CHECK TYPE TABLE OF T_FINAL,
WA_CHECK TYPE T_FINAL.
LOOP AT I_FINAL INTO WA_FINAL.
IF WA_FINAL-CHK_BOX = 'X'.
APPEND WA_FINAL TO I_CHECK.
{ APPEND WA_FINAL TO I_CHECK[] also I try}
ENDIF.
ENDLOOP.
In layout:
LS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
LS_LAYOUT-BOX_FIELDNAME = 'CHK_BOX'.try this its working for me......
*& Report ZHR_REPT_EMP_NOT_PBOOKED
*& Program title: List of employees who have not done Pre-Booking and
Provision to send E mail to such employees
*& Description: To display a list of emloyees in report and then sending mails to them
*& Business analyst: Vinay Kale/Abhijeet More
*& Developed by: Vivek Jain
REPORT ZHR_REPT_EMP_NOT_PBOOKED.
TYPE-POOLS slis.
tables
TABLES: pernr,
pa0001,
hrp1001,
hrp1000,
zodtab,
zcstab,
zsbutab.
Infotypes
INFOTYPES :0001, "org assignment,
1001,
1000,
0105.
TYPES : BEGIN OF i_conf,
checkbox ,
pernr TYPE pa0001-pernr, "personnel Number.
ename TYPE pa0001-ename, "Name of Employee.
zzbtc TYPE pa0001-zzbtc, "Band.
btrtl TYPE pa0001-btrtl, "Grade
Location type string,
persk type string,
ptext type string,
werks TYPE p0001-werks,
zzod_txt type string, "OD name
zzod type pa0001-zzod,
zzcs type string, "cluster/sector
vertical type string,
sbu LIKE pa0001-zzsbu, "SBU
sbutxt LIKE zsbutab-zsbutxt, "SBUTXT
orgeh LIKE pa0001-orgeh, "Vertical
org_text type string,
zzbloc LIKE pa0001-zzbloc, "base location
dept_loc type string, "dept loc
ename_s LIKE pa0001-ename, "Department
zztc LIKE pa0001-zztc,
endda type p0001-endda,
celltab type lvc_t_styl,
tc_name type string,
tc_num type string,
END OF i_conf.
DATA : it_conf TYPE STANDARD TABLE OF i_conf WITH HEADER LINE,
wa_conf TYPE i_conf.
*data: begin of gs_outtab.
*data: checkbox type c. "field for checkbox
§B1.Extend your output table by a field to dis- or enable
cells for input.
*data: celltab type lvc_t_styl. "field to switch editability
include structure i_conf.
*data: end of gs_outtab.
*data: gt_outtab type gs_outtab occurs 0 with header line.
*& DATA DECLARATION FOR EMAIL
DATA: docdata TYPE sodocchgi1,
objpack TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,
objhead TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
objtxt TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
objbin TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
reclist TYPE STANDARD TABLE OF somlreci1 WITH HEADER LINE.
DATA: tab_lines TYPE sy-tabix.
DATA : p_1001 TYPE TABLE OF p1001 WITH HEADER LINE.
DATA : p_0001 TYPE TABLE OF p0001 WITH HEADER LINE.
DATA : p_0105 TYPE TABLE OF p0105 WITH HEADER LINE.
DATA : od TYPE p0001-zzod.
DATA : new_pernr type p0001-pernr.
DATA : pernr_s type p0001-pernr.
DATA : email_s type p0105-USRID_LONG.
DATA : email type p0105-USRID_LONG.
DATA : tc_name type string.
DATA : tc_num type string.
DATA : emails type string.
DATA : sel_all type string.
DATA: REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA : flag type i.
DATA : title TYPE string.
DATA : pernr_temp tYPE p0001-pernr.
DATA : rel type string.
DATA : stat type string.
DATA : count type i.
DATA : v_dynnr type sy-dynnr.
DATA : g_grid type ref to cl_gui_alv_grid.
DATA : g_custom_container type ref to cl_gui_custom_container,
g_container type scrfname value 'CC'.
************field cat*******************************
DATA: fieldcat TYPE lvc_t_fcat,
wa_fieldcat LIKE LINE OF fieldcat.
DATA: gd_layout TYPE lvc_s_layo,
gd_repid TYPE sy-repid.
DATA:gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader.
DATA rec_fetched TYPE sy-tabix.
CONSTANTS g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_zzod FOR zsbutab-zod NO INTERVALS ,
s_btrtl FOR pa0001-btrtl NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
start-of-selection.
if pn-begda is initial.
pn-begda = '18000101'.
endif.
if pn-endda is initial.
pn-begda = '99991230'.
endif.
clear : it_conf,it_conf[].
get pernr.
clear new_pernr.
move pernr-pernr to new_pernr.
*************checking whether employee has booked or prebooked for any event***************
clear: p_1001,p_1001[].
perform read_info tables p_1001 using new_pernr '1' 'B027' .
IF SY-SUBRC <> 0.
clear: p_1001,p_1001[].
perform read_info tables p_1001 using new_pernr '1' 'B023' .
IF SY-SUBRC <> 0.
clear: p_1001,p_1001[].
perform read_info tables p_1001 using new_pernr '2' 'B027' .
IF SY-SUBRC <> 0.
clear: p_1001,p_1001[].
perform read_info tables p_1001 using new_pernr '2' 'B023' .
IF SY-SUBRC <> 0.
clear : p_0001,p_0001[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = new_pernr
infty = '0001'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
infty_tab = p_0001
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
sort p_0001 descending by begda.
read table p_0001 index 1.
move p_0001-pernr to wa_conf-pernr.
move p_0001-ename to wa_conf-ename.
move p_0001-zzbtc to wa_conf-zzbtc.
move p_0001-btrtl to wa_conf-btrtl.
move p_0001-werks to wa_conf-werks.
move p_0001-zzsbu to wa_conf-sbu.
move p_0001-orgeh to wa_conf-orgeh.
move p_0001-zzbloc to wa_conf-zzbloc.
move p_0001-zztc to wa_conf-zztc.
move p_0001-zzod to wa_conf-zzod.
move p_0001-endda to wa_conf-endda.
move p_0001-btrtl to wa_conf-btrtl.
***************************sending mail to employee and his/her superior***********************************
select single sachn telnr into (wa_conf-tc_name , wa_conf-tc_num) from t526
where SACHX = it_conf-zztc
and werks = it_conf-werks .
**************clustor txt*********************
select single zcstxt into wa_conf-zzcs from zcstab
where zcs = p_0001-zzcs
and zod = p_0001-zzod.
**********operating division******************************
select single ZODLTXT into wa_conf-zzod_txt from zodtab
where zod = wa_conf-zzod.
**********sbu txt**************************************************************
select single zsbutxt into wa_conf-sbutxt from zsbutab
where zsbu = wa_conf-sbu.
**********location*************************************
select single btext into wa_conf-location from t001p
where btrtl = wa_conf-btrtl
and werks = wa_conf-werks.
**********Dept********************************************
select single orgtx into wa_conf-org_text from t527x
where sprsl = 'EN'
and orgeh = wa_conf-orgeh
and begda <= p_0001-begda
and endda >= p_0001-begda.
**************grade*****************************************
SELECT SINGLE ptext FROM t503t INTO wa_conf-persk
WHERE sprsl = 'EN'
AND persk = p_0001-persk .
*******************vertical****************************
select single zverttxt into wa_conf-vertical from zvtab
where zvert = p_0001-zzvert.
*******deputation location*****************
if p_0001-ZZDEPFLG = 'X'.
select single zdltxt into wa_conf-dept_loc from zdltab where zdl = p_0001-zzdploc.
endif.
***get imm superior
CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
EXPORTING
pernr = new_pernr
begda = '18000101'
endda = '99991231'
IMPORTING
v_pernr = pernr_s
EXCEPTIONS
not_found = 1
OTHERS = 2.
if sy-subrc = 0.
find the email of the immed. superiors personal number..
clear : p_0001,p_0001[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr_s
infty = '0001'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
infty_tab = p_0001
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
read table p_0001 index 1.
move p_0001-ename to wa_conf-ename_s.
endif.
if wa_conf-btrtl in s_btrtl and wa_conf-zzod in s_zzod .
append wa_conf to it_conf.
endif.
endif.
endif.
endif.
endif.
clear wa_conf.
end-of-selection.
if it_conf[] is initial.
MESSAGE i501(zmod).
exit.
endif.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'USER'.
SET TITLEBAR 'xxx'.
if g_custom_container is initial.
data: lt_exclude type ui_functions.
create object g_custom_container
EXPORTING
container_name = g_container.
create object g_grid
EXPORTING
i_parent = g_custom_container.
perform fieldcat_build .
Exclude all edit functions in this example since we do not need them:
perform exclude_tb_functions changing lt_exclude.
perform build_data.
*§ B3.Use the layout structure to aquaint additional field to ALV.
gd_layout-stylefname = 'CELLTAB'.
PERFORM build_layout.
if it_conf[] is initial.
MESSAGE i501(zmod). "No data exists
else.
call method g_grid->set_table_for_first_display
EXPORTING
is_layout = gd_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = fieldcat
it_outtab = it_conf[].
create object g_event_receiver.
set handler g_event_receiver->catch_doubleclick for g_grid.
Set editable cells to ready for input initially
call method g_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
endif.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
*call screen 100.
*& Form build_layout
FORM build_layout.
CLEAR gd_layout.
v_dynnr = 100.
gd_layout-cwidth_opt = 'X'.
gd_layout-zebra = 'X'.
gd_layout-grid_title = text-002.
ENDFORM. "build_layout
*& Form exclude_tb_functions
text
-->PT_EXCLUDE text
form exclude_tb_functions changing pt_exclude type ui_functions.
data ls_exclude type ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
append ls_exclude to pt_exclude.
endform. "exclude_tb_functions
*& Form field_cat
text
FORM fieldcat_build .
wa_fieldcat-fieldname = 'CHECKBOX'.
wa_fieldcat-tabname = 'IT_CONF'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'PERNR'.
wa_fieldcat-coltext = 'P.S. No'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ENAME'.
wa_fieldcat-coltext = 'Employee Name'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ZZBTC'.
wa_fieldcat-coltext = 'Band'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'PERSK'.
wa_fieldcat-coltext = 'Grade'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ZZOD_TXT'.
wa_fieldcat-coltext = 'OD Name'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ZZCS'.
wa_fieldcat-coltext = 'Cluster / Sector '.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'VERTICAL'.
wa_fieldcat-coltext = 'Vertical'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'SBUTXT'.
wa_fieldcat-coltext = 'SBU'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ORG_TEXT'.
wa_fieldcat-coltext = 'Dept.'.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'LOCATION'.
wa_fieldcat-coltext = 'Empl. Base Location '.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'DEPT_LOC'.
wa_fieldcat-coltext = 'Empl. Deputation Location '.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ENAME_S'.
wa_fieldcat-coltext = 'IS Name '.
wa_fieldcat-tabname = 'IT_CONF'.
APPEND wa_fieldcat TO fieldcat.
clear wa_fieldcat.
endform. "field_cat
*& Form check_lock
text
-->PS_OUTTAB text
-->P_LOCKED text
form check_lock using ps_outtab type i_conf
changing p_locked.
data ls_celltab type lvc_s_styl.
loop at ps_outtab-celltab into ls_celltab.
if ls_celltab-fieldname = 'CHECKBOX'.
if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
p_locked = 'X'.
else.
p_locked = space.
endif.
endif.
endloop.
endform. "check_lock
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
IF sy-ucomm = 'EMAIL'.
clear it_conf.
CALL METHOD g_grid->refresh_table_display.
data: ls_outtab type i_conf.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
IMPORTING
e_valid = l_valid.
if l_valid eq 'X'.
loop at it_conf into ls_outtab.
if not ls_outtab-checkbox is initial
and not ls_outtab-checkbox eq '-'.
***************************sending mail to employee and his/her superior***********************************
select single sachn telnr into (tc_name , tc_num) from t526
where SACHX = ls_outtab-zztc
and werks = ls_outtab-werks .
******find the emil of employee.
clear : p_0105,p_0105[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = ls_outtab-pernr
infty = '0105'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
infty_tab = p_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
if sy-subrc = 0.
read table p_0105 with key subty = '0010'.
move p_0105-USRID_LONG to email.
endif.
find immediate superior by Z FM.
clear pernr_s.
CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
EXPORTING
pernr = ls_outtab-pernr
IMPORTING
v_pernr = pernr_s
EXCEPTIONS
not_found = 1
OTHERS = 2.
if sy-subrc = 0.
find the email of the immed. superiors personal number..
clear : p_0105,p_0105[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr_s
infty = '0105'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
infty_tab = p_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
read table p_0105 with key subty = '0010'.
move p_0105-USRID_LONG to email_s.
endif.
if email <> ' '.
count = 1.
perform send_mail using ls_outtab-ename email email_s tc_name tc_num count .
endif.
if email_s <> ' '.
count = 2.
perform send_mail using ls_outtab-ename email email_s tc_name tc_num count.
endif.
call method g_grid->refresh_table_display.
modify it_conf from ls_outtab.
endif.
endloop.
call method g_grid->refresh_table_display.
endif.
set screen 100.
endif.
**************************end of sending mail****************************************************
IF sy-ucomm = 'SELECT'.
CALL METHOD g_grid->refresh_table_display.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
IMPORTING
e_valid = l_valid.
if l_valid eq 'X'.
loop at it_conf into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = 'X'.
endif.
modify it_conf from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
set screen 100.
endif.
IF sy-ucomm = 'BCK' and v_dynnr = 100.
clear v_dynnr.
set screen 1000.
leave screen. " 0."1000.
**call selection-screen 1000.
*call screen 1000.
endif.
IF sy-ucomm = 'EXIT' and v_dynnr = 100.
clear v_dynnr.
leave program.
endif.
IF sy-ucomm = 'CANC' and v_dynnr = 100.
clear v_dynnr.
leave program.
endif.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form send_mail
text
-->EMAIL_S text
-->EMAIL text
-->TC_NAME text
-->TC_NUM text
form send_mail using ename email email_s tc_name tc_num count.
*Body of mail
CLEAR objtxt.
CLEAR objtxt[].
objtxt = text-005.
concatenate objtxt ename into objtxt separated by space.
append objtxt.
clear objtxt.
objtxt = text-006.
concatenate objtxt email_s into objtxt separated by space.
append objtxt.
clear objtxt.
append objtxt.
objtxt = text-002.
append objtxt.
clear objtxt.
objtxt = text-003.
append objtxt.
clear objtxt.
append objtxt.
objtxt = text-004.
concatenate objtxt tc_name 'at' tc_num into objtxt separated by space.
append objtxt.
clear objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
*Mail description
CLEAR docdata.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
docdata-obj_name = 'Reminder'.
docdata-obj_descr = 'REMINDER TO DO PRE-BOOKING'.
docdata-obj_langu = sy-langu.
*Packing list for main document
CLEAR objpack.
CLEAR objpack[].
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
*Email receiver's list
CLEAR reclist.
CLEAR reclist[].
if count = 1.
reclist-receiver = '[email protected]'.
reclist-receiver = email.
else.
reclist-receiver = email_s.
endif.
reclist-rec_type = 'U'.
APPEND reclist.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = docdata
document_type = 'RAW'
put_in_outbox = 'X'
commit_work = 'X'
TABLES
object_content = objtxt
receivers = reclist
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
message 'mail(s) sent successfully' type 'S'.
ENDIF.
endform. "send_mail
*& Form eventtab_build
FORM eventtab_build USING rt_events TYPE slis_t_event.
*Registration of events to happen during list display
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. "eventtab_build
*& Form top_of_page
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM. "top_of_page
*& Form COMMENT_BUILD
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader,
rp_date TYPE string. "report date
LIST HEADING LINE: TYPE H
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-007.
APPEND ls_line TO lt_top_of_page.
CONCATENATE sy-datum6(2) sy-datum4(2) sy-datum(4) INTO rp_date SEPARATED BY '.'.
STATUS LINE: TYPE S
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = text-008.
ls_line-info = rp_date.
APPEND ls_line TO lt_top_of_page.
ENDFORM. "comment_build
*& Form read_info
text
-->P_1001 text
-->PERNR text
-->STAT text
-->REL text
form read_info tables p_1001 using pernr stat rel.
CALL FUNCTION 'RH_READ_INFTY_1001'
EXPORTING
AUTHORITY = 'DISP'
WITH_STRU_AUTH = 'X'
PLVAR = '01'
OTYPE = 'P'
OBJID = pernr
ISTAT = stat
SUBTY = rel
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
I1001 = p_1001
EXCEPTIONS
NOTHING_FOUND = 1
WRONG_CONDITION = 2
WRONG_PARAMETERS = 3
OTHERS = 4.
endform. "read_info
*& Module BACK INPUT
text
MODULE BACK INPUT.
IF SY-UCOMM = 'E'.
leave program.
endif.
IF SY-UCOMM = 'ENDE'.
leave program.
endif.
IF SY-UCOMM = 'ECAN'.
leave program.
endif.
ENDMODULE. " BACK INPUT -
How to middle text in a text area?
Can someone tell me how to middle the text (vertically) on a JTextArea? It always starts at the top.
Thanks to all in advance
sridharUm, assuming by "middle the text" you mean scroll the text area to the vertical center of the text area:
1) Enclose your text area in a JScrollPane.
2) Get the vertical scroll bar of the scroll pane using:
JScrollBar scrollbar = scrollpane.getVerticalScrollBar();3) Find the middle of the scroll bar using:
scrollbar.setValue(scrollbar.getMaximum() / 2);
Maybe you are looking for
-
Lame Foldernavigation with Zen Stone plus with spea
I purchased the 4GB Model because i hear a lot of Audiobooks. Those are organised in folders. I downloaded the manual / help file before purchasing and was quite happy that the Zen support folders. Now im disappointed the way the Zen Stone handles th
-
Doesn't work spotlight in Yosemite 10.10.3, How can i re
test: Start time: 00:17:13 04/20/15 Revision: 1207 Model Identifier: iMac13,2 System Version: OS X 10.10.3 (14D136) Kernel Version: Darwin 14.3.0 Time since boot: 2 days 5:41 UID: 501 USB USB3.0 Hub (VIA Labs, Inc.) USB3.0 Hub (VIA Labs, Inc.)
-
URGENT -- Problem in using JMS with JBOSS
Hi, My jar file which includes my Java/JMS classes can easily be executed when I use Sun Application server, but I don't know how I can change execute the same jar file in when I switch to JBOSS. Do I need to use ants? or I can use the original jar f
-
How can I scan my network to determine which PC is using static IP or DHCP?
Hello friends, I`m using Spiceworks for couple of days alreadyand need some help on this - In another post i saw that via SpiceWorks I can see how many PCs are using DHCP or Static IP (http://community.spiceworks.com/topic/37663-how-can-i-scan-my-net
-
Problems connecting to an Oracle database
The service name in my pc is GACASASF and the name of the table that I'm trying to query is DEPT. Could you please tell me what's wrong with my connection, is not working. I think that it has something to do with the connecting string. I went to ODBC