Home » Developer & Programmer » Forms » Undo typing
Undo typing [message #178198] Tue, 20 June 2006 01:59 Go to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
I have a menu option Undo Typing

I have no idea how to implement the code for the same.

Anyone can please help.

Thanks

Nirmal
Re: Undo typing [message #178217 is a reply to message #178198] Tue, 20 June 2006 03:06 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
For the current item, have a look at the CLEAR_ITEM built-in. There's also a CLEAR_BLOCK built-in.

MHE
Re: Undo typing [message #178236 is a reply to message #178217] Tue, 20 June 2006 04:08 Go to previous messageGo to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
The problem with CLEAR_ITEM is that it will clear anything in the current item. For eg., if there is already something present in the item, and the user types something in addition to it and clicks 'Undo Typing' , only the additionaly typed one should clear the old value should remain in the item.

But CLEAR_ITEM cannot distinct between the old value and new value and will clear out the whole thing.


Thanks and Regards,

Nirmal Narayanan.
Re: Undo typing [message #178239 is a reply to message #178236] Tue, 20 June 2006 04:18 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
You can revert the item to it's database value:
:yourblock.youritem := get_item_property('yourblock.youritem', DATABASE_VALUE);


MHE
Re: Undo typing [message #178246 is a reply to message #178239] Tue, 20 June 2006 05:18 Go to previous messageGo to next message
saadatahmad
Messages: 452
Registered: March 2005
Location: Germany/Paderborn
Senior Member

you can capture the old value in a variable and then do the following to undo the additional writing.
I'm providing you the basic idea and code, do the remaining work yourself.

Create an employee form based on EMP table from scot schema.
Create a button and write the following code in When-Button-Pressed trigger.

DECLARE
        v_value VARCHAr2(100);
	v_undo_value VARCHAR2(100);
	v_length NUMBER;
BEGIN
	v_length := LENGTH(:EMP.ename);
	v_value := :EMP.ename;
	v_undo_value := SUBSTR(v_value, 1, v_length-1);
	:EMP.ename := v_undo_value;
END;


Now, insert a new record and type in th ename field. Whn you'll press the button this code will be starting removing the last characters from the string.
For your case, you can capture the old value in variable and after pressing the button remove all the newly entered characters from the string that will be your required functionality.
Hop ethis is what you were looking for.

regards,
Saadat Ahmad
Re: Undo typing [message #178397 is a reply to message #178246] Wed, 21 June 2006 00:47 Go to previous messageGo to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
Your suggession is good one. The problem is i am having this 'Undo Typing' in a custom menu. To implement your idea, i need to code in every item of every form i am having.

There is any better way to do this in the menu item code itself?

Thanks

Nirmal
Re: Undo typing [message #178432 is a reply to message #178397] Wed, 21 June 2006 02:39 Go to previous messageGo to next message
saadatahmad
Messages: 452
Registered: March 2005
Location: Germany/Paderborn
Senior Member

You can use this code in your menu item as well. Instead of using this :
	v_length := LENGTH(:EMP.ename);
	v_value := :EMP.ename;

Use this:
	v_length := LENGTH(:SYSTEM.trigger_item);
	v_value := (:SYSTEM.trigger_item;


regards

[Updated on: Wed, 21 June 2006 02:41]

Report message to a moderator

Re: Undo typing [message #178497 is a reply to message #178432] Wed, 21 June 2006 04:57 Go to previous messageGo to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
Thank you saadat, i think it will help

Thanks and Regards,

Nirmal
Re: Undo typing [message #178653 is a reply to message #178497] Thu, 22 June 2006 02:10 Go to previous messageGo to next message
kbhujendra@rediffmail.com
Messages: 26
Registered: June 2006
Location: Hyderabad,India
Junior Member

Hi,
Try This code,

PROCEDURE loop_first
IS
BEGIN

DECLARE
l_first_item VARCHAR2(100);
l_last_item VARCHAR2(100);
l_curr_item VARCHAR2(100);
l_curr_block VARCHAR2(100);

BEGIN

l_curr_block := :system.cursor_block;

l_first_item := l_curr_block || '.' || Get_block_property (:system.cursor_block,
first_item);

l_last_item := l_curr_block || '.' || Get_block_property(:system.cursor_block,
last_item);

Go_item(l_first_item);

l_curr_item := :system.cursor_item;

LOOP

IF l_curr_item <> l_last_item THEN

Copy(Get_item_property(l_curr_item,database_value)
,l_curr_item);

Go_item(Get_item_property(l_curr_item,
nextitem));

l_curr_item := :system.cursor_item;

END IF;


END LOOP;

Copy(Get_item_property(l_curr_item,database_value)
,l_curr_item);

l_curr_item := :system.cursor_item;

Set_record_property(:system.cursor_record,
l_curr_block,
status,
query_status);

Go_item(l_first_item);

END;
END;

Solve your problem,
waiting for feedback.

Thanks,
Bhujendra
Undo typing feature database and non-database blocks [message #178691 is a reply to message #178653] Thu, 22 June 2006 03:55 Go to previous messageGo to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
Hi,

Thank you for your code, but it will work only once in a field or item.

The second time i type something in the same field and tries 'Undo Typing' it does'nt work. Also it will not work for non-database items. Intended functionality is for both database items and non-database items in a block.

So i modified your code code like the one below and is working as expected, for both database and non-database blocks



Declare

l_curr_item varchar2(100);
l_currval varchar2(100);
l_dbvalue varchar2(100);

Begin

/* get the cursor item */
l_curr_item := :system.cursor_item;

/* get the current cursor value */

l_currval := :system.cursor_value;

/* get the database value into l_dbvalue (applicable for both database and non-database items, non-database items will return the current value */

l_dbvalue := Get_item_Property(l_curr_item, database_value);

/* if both dbvalue and current value is identical it means the value is a non-database item value */

if l_dbvalue=l_currval then

/* set the old value into :global.oldval in the pre-text-item trigger of the non-database items in the form
copy this :global.oldval into current item */

copy(nvl(:global.oldval,''),l_curr_item);

end if;

/* Copy this value into back into the current item */

Copy(Get_item_Property(l_curr_item,database_value),l_curr_item);


End;



---------

Thanks

Nirmal



Re: Undo typing feature database and non-database blocks [message #178696 is a reply to message #178691] Thu, 22 June 2006 04:05 Go to previous messageGo to next message
kbhujendra@rediffmail.com
Messages: 26
Registered: June 2006
Location: Hyderabad,India
Junior Member

Thanks for update.


HTH,
Bhujendra
Re: Undo typing feature database and non-database blocks [message #178720 is a reply to message #178696] Thu, 22 June 2006 06:11 Go to previous messageGo to next message
RJ.Zijlstra
Messages: 104
Registered: December 2005
Location: Netherlands - IJmuiden
Senior Member
Please check out the following, it is shorter and is described in 'HELP'

----------------------------------------------------------------
win_api_shell.sendkeys(
hWnd => get_window_property( FORMS_MDI_WINDOW , WINDOW_HANDLE) ,
keys => '{Backspace}',
RaiseExceptions => TRUE
);
----------------------------------------------------------------

OR

----------------------------------------------------------------
win_api_shell.sendkeys(
hWnd => get_window_property( YOUR_WINDOW_NAME , WINDOW_HANDLE) ,
keys => '{Backspace}',
RaiseExceptions => TRUE
);
----------------------------------------------------------------
HTH,

Regards,

Rob Zijlstra
Re: Undo typing feature database and non-database blocks [message #178731 is a reply to message #178720] Thu, 22 June 2006 06:39 Go to previous messageGo to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
But when i tried the 'win_api' code you suggested, it was giving the compilation error, saying that the win_api should be declared. I am using Oracle FORMS 10g for, and i could not find anything regarding this in HELP

Also, i think that this will not work for other platforms , it will work only for windows platforms is it so?

Thanks,


Nirmal

[Updated on: Thu, 22 June 2006 06:40]

Report message to a moderator

Re: Undo typing feature database and non-database blocks [message #178756 is a reply to message #178731] Thu, 22 June 2006 08:26 Go to previous message
RJ.Zijlstra
Messages: 104
Registered: December 2005
Location: Netherlands - IJmuiden
Senior Member
Hai,

As far as I know you CANNOT use it in Forms 10G:

http://www.oracle.com/technology/products/forms/htdocs/forms904faq.html
<snip>
2.9 Can I use the functions in the D2KWUTIL library when Forms is running on NT?

No. We don't support the use of D2KWUTIL in the middle tier. Many of the functions in the library require access to Window Handles, which will not work in the Web deployment scenario. While some functions, such as WIN_API_ENVIRONMENT.GET_COMPUTER_NAME(), do work, they return information about the application server machine, not the client. Some functions, such as the bitwise operations, continue to function without a problem.

However, Oracle have a provided a utility called WebUtil which will give you parity with the functionality of D2KWUTIL, and more! For more information on WebUtil, including a WebUtil FAQ, visit the WebUtil area on OTN.
<end snip>

But maybe the WEBUTIL FAQ can help you.

HTH, regards

Rob Zijlstra
Previous Topic: where will i get free ebooks
Next Topic: image loading in database
Goto Forum:
  


Current Time: Fri Sep 20 09:44:46 CDT 2024