Home » Developer & Programmer » Forms » Disabling all the block except single item (Windows)
Disabling all the block except single item [message #615525] Thu, 05 June 2014 03:37 Go to next message
shabbier.sa
Messages: 12
Registered: May 2014
Location: Saudi Arabia
Junior Member

Hello Guys , This is Shabbier ,i have just got a problem. When i enter empno and check the box then rest of items should be disabled.
i got the code. But at the end i am getting message " CAN NOT SET ENabled ITEM for LAst item in the Block.."
Could u please assist me on this.
Re: Disabling all the block except single item [message #615528 is a reply to message #615525] Thu, 05 June 2014 03:45 Go to previous messageGo to next message
Littlefoot
Messages: 19610
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:

for last item


Is it really the last item, or is it the current item? Unless I'm wrong, there's nothing special in the last item in a block, but - you can't disable an item which is currently in focus (that would be the checkbox itself, I suppose).
Re: Disabling all the block except single item [message #615719 is a reply to message #615528] Sun, 08 June 2014 02:17 Go to previous messageGo to next message
shabbier.sa
Messages: 12
Registered: May 2014
Location: Saudi Arabia
Junior Member

i am just disabling all the items in a block.

PROCEDURE Disable_block( blk_name IN VARCHAR2,L_ITEM VARCHAR2 ) IS
blk_id Block;
t varchar2(30);
c varchar2(40);
a number:=0;
first_item varchar2(40);
n number :=1;

BEGIN /* Lookup the block's internal ID */
blk_id := Find_Block(blk_name);

go_block (blk_name);
first_item := :SYSTEM.current_field;

WHILE (:SYSTEM.CURSOR_ITEM != L_ITEM )
loop
t:=:system.current_item;
c:=blk_name||'.'||t;
next_item;
set_item_property(c,enabled,property_false);
end loop;
end;
i wrote the above code. it's disabling all the items except the last one and giving error..
Re: Disabling all the block except single item [message #615724 is a reply to message #615719] Sun, 08 June 2014 07:15 Go to previous messageGo to next message
Littlefoot
Messages: 19610
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you read what I said, as well as your code, you'll see that the last item is also the current item at that time. You can't disable current item. First you have to move elsewhere.

What are you trying to do, anyway? Why don't you simply modify the whole block's properties with SET_BLOCK_PROPERTY, instead of item by item?
Re: Disabling all the block except single item [message #615804 is a reply to message #615724] Mon, 09 June 2014 06:45 Go to previous messageGo to next message
shabbier.sa
Messages: 12
Registered: May 2014
Location: Saudi Arabia
Junior Member

But I want to keep one item must be enable. if user re-check that box all the items must be enabled.
  • Attachment: Emp.jpg
    (Size: 172.54KB, Downloaded 27 times)

[Updated on: Mon, 09 June 2014 06:51]

Report message to a moderator

Re: Disabling all the block except single item [message #615805 is a reply to message #615804] Mon, 09 June 2014 07:00 Go to previous messageGo to next message
Littlefoot
Messages: 19610
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In that case, pay attention to which items you are disabling in the WHILE loop you use. Don't disable the checkbox item.
Re: Disabling all the block except single item [message #615806 is a reply to message #615805] Mon, 09 June 2014 07:08 Go to previous messageGo to next message
cookiemonster
Messages: 10961
Registered: September 2008
Location: Rainy Manchester
Senior Member
The list of items being disabled is static and known at compile time.
So instead of writing a loop that goes through each item in the block why not simply write a procedure with a set_item_property for each item you want disabled.
Re: Disabling all the block except single item [message #616533 is a reply to message #615806] Wed, 18 June 2014 01:18 Go to previous messageGo to next message
shabbier.sa
Messages: 12
Registered: May 2014
Location: Saudi Arabia
Junior Member

system.cursor_field='CURSOR'
can u guys please explain me what above one indicates to.
Re: Disabling all the block except single item [message #616536 is a reply to message #616533] Wed, 18 June 2014 01:34 Go to previous messageGo to next message
Littlefoot
Messages: 19610
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Indicates to an error, I'd say. There's no such thing as "system.cursor_field" (at least, as far as I can tell). System variables begin with a colon (which is missing in your example).

There are :system.cursor_item and :system.current_item which are described in Forms Online Help system, so - have a look.

:system.cursor_item (which is similar to what you asked) returns name of the block and item (such as emp.ename); your example contains only 'CURSOR' which is certainly not a block.item.

:system.current_item returns an item name (without the block prefix).

So, 'CURSOR' *might* be an item name, but used with a wrong :system variable.

[Updated on: Wed, 18 June 2014 01:38]

Report message to a moderator

Re: Disabling all the block except single item [message #616624 is a reply to message #616536] Thu, 19 June 2014 03:09 Go to previous messageGo to next message
shabbier.sa
Messages: 12
Registered: May 2014
Location: Saudi Arabia
Junior Member

Ok friends at most i have clear all the errors. But tell me One thing How to enable only text items not buttons
I know it is possible through Get_item_property ,But what attribute to use to capture only Button items
Re: Disabling all the block except single item [message #616625 is a reply to message #616624] Thu, 19 June 2014 03:18 Go to previous messageGo to next message
shabbier.sa
Messages: 12
Registered: May 2014
Location: Saudi Arabia
Junior Member

Sorry I am really Disturbing you Guys. But Last i checked everywhere. tell me in oracle forms i disabled the form except item. everything done ok. BUt with out enabling i clear the form . When i try to enter new employee data the fields are still disabled .i cant enter data .pls assist me .
Re: Disabling all the block except single item [message #616627 is a reply to message #616625] Thu, 19 June 2014 03:22 Go to previous messageGo to next message
cookiemonster
Messages: 10961
Registered: September 2008
Location: Rainy Manchester
Senior Member
Clearing the form has zero effect on the enabled property of the items. The only way to re-enable them is to call set_item_property for each item.
Re: Disabling all the block except single item [message #616629 is a reply to message #616627] Thu, 19 June 2014 03:27 Go to previous messageGo to next message
Littlefoot
Messages: 19610
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Also, note that just ENABLING items isn't enough because setting that property to FALSE causes other properties to change as well. Therefore, you'll have to modify item's INSERT_ALLOWED, UPDATE_ALLOWED properties as well.
Re: Disabling all the block except single item [message #616632 is a reply to message #616629] Thu, 19 June 2014 03:50 Go to previous message
cookiemonster
Messages: 10961
Registered: September 2008
Location: Rainy Manchester
Senior Member
and keyboard_navigable from memory
Previous Topic: how to remove spaces in the field flat file
Next Topic: dynamic item instance control
Goto Forum:
  


Current Time: Thu Sep 18 06:45:16 CDT 2014

Total time taken to generate the page: 0.11023 seconds