Cursor manipulation within a text item [message #167199] |
Tue, 11 April 2006 16:43 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rcd70
Messages: 14 Registered: April 2006 Location: Auckland, New Zealand
|
Junior Member |
|
|
Hi
Is there any way of positioning the cursor in a text item or highlighting a part of the text.
I am working on an issue on a form which has a multiline text item. Its difficult for the user to search a string (like name) in the text item as they have to scroll through the entire text item, because at times it can be quite big.
So the solution I came up with is having a SEARCH text item and a checkbox, wherein the user enter the string to be searched in the SEARCH text box and checks the checkbox and the text gets highlighted or the cursor is placed at the beginning of the string in the text item.
Is there any way of highlighting or placing the cursor in the text item at a desired place in the text item.
Any help is very much appreciated.
Thanks
|
|
|
Re: Cursor manipulation within a text item [message #167218 is a reply to message #167199] |
Tue, 11 April 2006 21:45 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
You will have to use a Java thingy to position the cursor.
I will search for an example and update this post later.
David
Upd: Look at this on metalink which mentions win_api_shell.sendkeys. I searched this forum for 'WIN_API_SHELL' and found this which says to look in d2kwutil, whose documentation says "WIN_API_SHELL - SendKeys - Allows you to simulate User Keystrokes via a macro language". So you use PL/SQL to determine how many cahracters into the field you wish to go, then by using 'win_api_shell.sendkeys' you can 'right arrow' the cursor to the start of the wanted string, then press 'shift' and 'right arrow' to select the text.
[Updated on: Wed, 12 April 2006 00:53] Report message to a moderator
|
|
|
Re: Cursor manipulation within a text item [message #168128 is a reply to message #167218] |
Tue, 18 April 2006 23:34 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rcd70
Messages: 14 Registered: April 2006 Location: Auckland, New Zealand
|
Junior Member |
|
|
Hi David
Using the win_api_shell.sendkeys, I can position the cursor at the begining or end within the text item. I wanted to place the cursor at the begining of the searched string.
Any suggestions apprecisted.
Thanks
|
|
|
|
Re: Cursor manipulation within a text item [message #168343 is a reply to message #168147] |
Wed, 19 April 2006 21:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rcd70
Messages: 14 Registered: April 2006 Location: Auckland, New Zealand
|
Junior Member |
|
|
Hi
THis is the code I am using :
win_api_shell.sendkeys(win,'^{Home}+{Right 1021}',FALSE);
This code highlights the code and places the cursor in the 1021 position in the text item which is correct. However, if the number of characters is more than 1021 the entire text gets highlighted and the cursor is at the end of the text. This is a problem as the text item could be upto 15000 characters.
Is there a limit on the number of positions the cursor can move within a text item.
Please advise.
|
|
|
|
Re: Cursor manipulation within a text item [message #168510 is a reply to message #168381] |
Thu, 20 April 2006 16:32 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rcd70
Messages: 14 Registered: April 2006 Location: Auckland, New Zealand
|
Junior Member |
|
|
When I use the code mentioned below
win_api_shell.sendkeys(win,'^{Home}+{Right 520}',FALSE);
win_api_shell.sendkeys(win,'+{Right 501}',FALSE);
It higlights the entire text and the freezes the screen. So it doesn't work.
While the code below takes me to the 1021 character within the text item.
win_api_shell.sendkeys(win,'^{Home}+{Right 1021}',FALSE);
It doesn't like two win_api_shell.sendkeys statements.
I am not sure what to do.
Rajesh
|
|
|
|
|
|
|
Re: Cursor manipulation within a text item [message #169436 is a reply to message #167199] |
Wed, 26 April 2006 17:02 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rcd70
Messages: 14 Registered: April 2006 Location: Auckland, New Zealand
|
Junior Member |
|
|
Hi David
I have no url as the form is used is inhouse. I got a sample code from google and used it. ^,+,% are all modifiers used for Shift = +; Control = ^; Alt = %.
I have placed the code on the when-new-item-instance for the text item.
DECLARE
/* Variable to store the window handle to the window from which we want the Operating system to interact.*/
win pls_integer;
total_len Number;
start_num Number;
search_num Number;
BEGIN
IF :control.search_string = 'YES' THEN
total_len := length(rtrim(ltrim(:sys_bls.bls_message)));
start_num := INSTR(:sys_bls.bls_message,rtrim(ltrim(:control.search)));
search_num := (total_len - start_num) + 1;
/*Test to see if the current item is a text item so we do not try to move to the end of a button.*/
IF get_item_property(:system.current_item, item_type) = 'TEXT ITEM' then
/*Get Window Handle and initialize it to our pls integer variable*/
win := get_window_property(forms_mdi_window, WINDOW_HANDLE);
win_api_shell.sendkeys(win,'^{Home}+{Right '||start_num||'}',FALSE);
END IF;
END IF;
END;
Rajesh
|
|
|
Re: Cursor manipulation within a text item [message #169453 is a reply to message #169436] |
Wed, 26 April 2006 22:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
I meant a url to the meaning of the '+^%' commands. If '+' means 'shift', then I would expect that '+{Right 10}' would highlight 10 characters. Is this correct?
Instead of win_api_shell.sendkeys(win,'^{Home}+{Right 520}',FALSE);
win_api_shell.sendkeys(win,'+{Right 501}',FALSE);
please trywin_api_shell.sendkeys(win,'^{Home}{Right 520}',FALSE);
win_api_shell.sendkeys(win,'{Right 501}',FALSE);
win_api_shell.sendkeys(win,'+{Right 10}',FALSE);
does this set of commands cause the cursor to highlight 10 characters a 1000 or so characters into the item?
Do you really need to use Ctrl-Home or will Home get you to the beginning of the item?
David
|
|
|
|
|
|
Re: Cursor manipulation within a text item [message #170046 is a reply to message #167199] |
Mon, 01 May 2006 20:46 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rcd70
Messages: 14 Registered: April 2006 Location: Auckland, New Zealand
|
Junior Member |
|
|
Hi David
I tried your suggestions, but I could not get it working.
win_api_shell.sendkeys(win,'^{Home}{Right '||right_no||'}',FALSE);
message('kkkkkkkkkkkkk');pause;
:control.search_string := 'NO';
If I give any instructions after the win_api_shell.sendkeys line, it does not work even if the string is less than 1023 characters. The entire text gets highlighted and the cursor is at the end of the text.
I believe after executing the win_api_shell.sendkeys line, the program loses control.ie. it cannot execute the lines thereafter.
Your suggestions.
Rajesh
|
|
|
|
|
|
|