Create/Editing and deleting classes without ide?

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Tim M >> Tue, 2 Sep 2008 8:35:47 GMT

Can someone give me an example of creating,editing and deleting classes in code?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Allistar >> Tue, 2 Sep 2008 11:00:49 GMT

The only way to do this without using the IDE is to use jadload programatically. You can use a command file (.jcf) to remove a class, and can generate a .scm file to add a class.

I suspect though that that is not what you intended.

You may be able to use JDO's (Jade Dynamic Objects) to achieve your goal.

Can I ask why you want to create/edit/delete classes at runtime?
--
A.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Tim M >> Tue, 2 Sep 2008 23:38:54 GMT

Are you saying that when I right click on a class that's what jade schema is doing. So what does the following do:

Schema::_deleteClass(cls : Class input);

Schema::delClass(cls : Class input) is schemaDelClass in jomsys;

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Dean Cooper >> Tue, 2 Sep 2008 23:58:33 GMT

The JADE IDE, schema loader and compiler update the meta-schema directly via methods such as those that you refer to. However, most of these methods are not available to non-system processes.

Dean.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Tim M >> Wed, 3 Sep 2008 9:09:36 GMT

Why not? or Can I get my process as system?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Dean Cooper >> Wed, 3 Sep 2008 9:24:27 GMT

No, system processes are only those applications that are provided by JADE. Other applications run as user processes.

Dean.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:22 pm

by Tim M >> Fri, 5 Sep 2008 0:17:53 GMT

OK but at least can you explain how I can update the persistent instance of a form. I can create a transient instance of a form, call makeFormPersistant(formName,superclassName : String) but i need to delete the old one. If i tried using the same name I got a duplicate key error i think.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:23 pm

by Patwos >> Fri, 5 Sep 2008 4:06:54 GMT

Programmatically adjusting forms etc is not officially supported in any form. Assuming all you're wanting to do is programmatically adjust say captions or positioning of existing controls then you need to be aware that you're dealing with a persistent instance of the Form class not an instance of your form subclass.

Once you have a reference to the appropriate Form class instance you can use the controlCount and controls methods to iterate each existing control and process as appropriate. For example, the following code snippet process the caption for most of the controls on a form that are of a control type that have a caption:

foreach ctlIndex in 1 to f.controlCount do

ctl := f.controls( ctlIndex );

if ctl.isKindOf( Button ) then
self.processCaption( ctl.Button.caption );
elseif ctl.isKindOf( CheckBox ) then
self.processCaption( ctl.CheckBox.caption );
elseif ctl.isKindOf( Frame ) then
self.processCaption( ctl.Frame.caption );
elseif ctl.isKindOf( GroupBox ) then
self.processCaption( ctl.GroupBox.caption );
elseif ctl.isKindOf( JadeDockBase ) then
self.processCaption( ctl.JadeDockBase.caption );
elseif ctl.isKindOf( Label ) then
self.processCaption( ctl.Label.caption );
elseif ctl.isKindOf( OptionButton ) then
self.processCaption( ctl.OptionButton.caption );
elseif ctl.isKindOf( JadeMask ) then
self.processCaption( ctl.JadeMask.caption );
elseif ctl.isKindOf( StatusLine ) then
self.processCaption( ctl.StatusLine.caption );
endif;

endforeach;

Be aware that this will not affect the formBuildData that is used at runtime to improve the runtime performance. You can correct this by opening all your top level superforms, that are direct decendents of Form, in the Jade Painter and saving the form to force the formBuildData to be rebuilt.

If you're wanting to do things like adding additional controls etc, then use the Jade Painter as there is too much behind the scenes meta data changes that you won't have access to running as a non-system application - especially given that programmatically changing your meta-data in this way is not officially supported.

Hope that helps,
Pat.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:23 pm

by Tim M >> Fri, 5 Sep 2008 4:31:42 GMT

Yeah I know that but what i am currently doing is saving he controls and replacing them at load. its a kind of report designer im making but i wanted to go one step better than that.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Create/Editing and deleting classes without ide?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:23 pm

by cnwjhp1 >> Fri, 5 Sep 2008 5:32:57 GMT

Have you considered simply using dynamic forms? You can create any number of controls etc at runtime. See the documentation for Form::addControl and Form::flagControlForSave. I generally clone new controls from existing ones that I created in Painter.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 31 guests