New Posts New Posts RSS Feed - Subclassing subobjects along with the object
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Subclassing subobjects along with the object

 Post Reply Post Reply
Author
Graham View Drop Down
Groupie
Groupie


Joined: 26-July-2016
Location: London, UK
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Graham Quote  Post ReplyReply Direct Link To This Post Topic: Subclassing subobjects along with the object
    Posted: 01-November-2016 at 10:11am
I have a block in an object library called top_menu. This block contains many items and those items contain many triggers.
In forms builder when I drag the block to a form and click Subclass in answer to the "Do you want to copy the object or subclass it?" the block and all it's items and triggers are all automatically subclass back to the object library.

I have been trying to do the same thing with FormsAPI Master 64bit V3.0(440 using forms11g) with code similar to the example below
DECLARE
  work_folder         varchar2;
  pas_cui_olb         number;
  form                number;
BEGIN
  work_folder := 'C:\work_2016_2\';
  pas_cui_olb := API_LoadModule(work_folder+'pas_cui.olb');

  -- NB <<<filename>>> form from a typical parameter screen
  form        := API_LoadModule(<<<filename>>>);


  pas_cui_object := objectlib_FindObjByName(pas_cui_olb,'TOP_MENU');
  new_og := Generic_FindObj(form,'TOP_MENU',D2FFO_BLOCK);
  LogAdd('Resubclassing TOP_MENU to PAS_CUI: cui obj no '||pas_cui_object||' and new obj no '||new_og);
  if new_og = 0 then
     new_og := generic_replicate(form,pas_cui_object,api_getObjectname(pas_cui_object));
  generic_subclass(new_og, pas_cui_object);

  -- free the loaded modules from memory
  API_FreeModule(form);
  API_FreeModule(pas_cui_olb);
END;

but this only subclasses the TOP_MENU block and it appears to be implying I have to go through every single subobject and their subobjects and resubclass individually?

Is this really the case, or am I noting making the best use of FormsAPI Master?

A second question I have is how up to date is the built in help?
I have discovered function called Generic_UnSubClass which is proving extremely useful for one of the tasks I am having to do, but this function does not appear in the built in help.
I came across a mention of it in a post dated 24-January-2012 by Stefan Mueller (Administrator)
"You mentioned it already, Generic_UnSubClass would be the easiest .. included in build 410. 
However, this new function is only available for Forms11g and later ..."

Back to Top
Graham View Drop Down
Groupie
Groupie


Joined: 26-July-2016
Location: London, UK
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Graham Quote  Post ReplyReply Direct Link To This Post Posted: 02-November-2016 at 11:11am
Since I wrote this I have discovered that I cannot go through very single subobject and their subobjects and resubclass individually as the subobjects do not exist in the object library in their own right (just within the block object) and thus you cannot find them in the object library to reclass them.
So I am going to have tow create a process that starts with a script and then is finished off manually.
Unless anyone can tell me how to subclass a block and all its subobjects to the version in an object library.
Thanks

Back to Top
administrator View Drop Down
Admin Group
Admin Group

Stefan Mueller

Joined: 25-January-2003
Location: New Zealand
Points: 1016
Post Options Post Options   Thanks (0) Thanks(0)   Quote administrator Quote  Post ReplyReply Direct Link To This Post Posted: 10-November-2016 at 4:08am
Graham,

Does TOP_MENU block already exist in the target or not? Looking through your script it all looks like it should work - i don't see any obvious problems in your logic.

The way subclassing works is that the target object should be just an empty object. I nowadays use generic_create() instead of generic_replicate()) and then subclass it to the source from the object library. Any child-objects will automatically be created next time the module is loaded, no need to loop through children yourself and subclass them.

can you send me your test script and modules to support@orcl-toolbox.com  ?

Regards,
Stefan

ps: The help-file should be up to date - but you are right, the Generic_UnSubclass() function was missing. I now added it and it will be released with the next build.

Back to Top
Graham View Drop Down
Groupie
Groupie


Joined: 26-July-2016
Location: London, UK
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Graham Quote  Post ReplyReply Direct Link To This Post Posted: 17-November-2016 at 7:03am
The TOP_MENU block used to exist in the form, but gets renamed to OLD_TOP_MENU earlier in the script (not shown in my earlier script), so no, TOP_MENU does not exist by the time I generic_replicate it.

I don't understand your statement
"Any child-objects will automatically be created next time the module is loaded, no need to loop through children yourself and subclass them."

Yes I agree all the child-objects are created, but what I was saying is that none of the child objects are being shown as being subclassed when I open up the form in formbuilder and look at them. Only the TOP_MENU block is being shown as subclassed (you know the little red arrow from bottom left to top right). All the child objects do not have that red arrow symbol.

However in forms builder when I drag the block to a form and click Subclass in answer to the "Do you want to copy the object or subclass it?" the block and all it's items and triggers are all automatically subclassed back to the object library WITH the little red arrow on the object and all of the child objects.

Do you want me to email you screen grabs showing the difference?

Thanks
Graham
Back to Top
administrator View Drop Down
Admin Group
Admin Group

Stefan Mueller

Joined: 25-January-2003
Location: New Zealand
Points: 1016
Post Options Post Options   Thanks (0) Thanks(0)   Quote administrator Quote  Post ReplyReply Direct Link To This Post Posted: 28-November-2016 at 4:13am
Dear Graham,

Generic_replicate() creates a flattened version of the all the object and child objects. What you really want is generic_create() and then subclass that newly created object. 

DECLARE
  work_folder         varchar2;
  pas_cui_olb         number;
  form                number;
BEGIN
  work_folder := 'C:\work_2016_2\';
  pas_cui_olb := API_LoadModule(work_folder+'pas_cui.olb');

  -- NB <<<filename>>> form from a typical parameter screen
  form        := API_LoadModule(<<<filename>>>);


  pas_cui_object := objectlib_FindObjByName(pas_cui_olb,'TOP_MENU');
  new_og := Generic_FindObj(form,'TOP_MENU',D2FFO_BLOCK);
  LogAdd('Resubclassing TOP_MENU to PAS_CUI: cui obj no '||pas_cui_object||' and new obj no '||new_og);
  if new_og = 0 then
     new_og := generic_create(form,'TOP_MENU',D2FFO_BLOCK);
  generic_subclass(new_og, pas_cui_object);

  -- free the loaded modules from memory
  API_FreeModule(form);
  API_FreeModule(pas_cui_olb);
END;
Back to Top
Graham View Drop Down
Groupie
Groupie


Joined: 26-July-2016
Location: London, UK
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Graham Quote  Post ReplyReply Direct Link To This Post Posted: 28-November-2016 at 8:22am
Thanks - that now does exactly what I want it to do.
Even to the point where I can create and subclass the object group I always wanted to and all the child and grand child etc objects are subclassed correctly (one visual attribute, two property_classes, three canvases, two blocks, four program units)

    pas_cui_object := objectlib_FindObjByName(pas_cui_olb,'ACTIONS_OG');
    LogAdd('Adding and subclassing ACTIONS_OG to PAS_CUI: cui obj no '||pas_cui_object);
    obj_actions_og := generic_create(form,'ACTIONS_OG',D2FFO_OBJ_GROUP);
    generic_subclass(obj_actions_og, pas_cui_object);

Smile

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.