Updating Control Properties outside Painter

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

Updating Control Properties outside Painter

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by Paul Mathews - C&M Systems Group >> Wed, 28 Jan 2004 23:10:26 GMT

eg the name, description, help.

Does anyone now how to update the permanent instance of the control on the form ?

I can update the text on the property .

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

Re: Updating Control Properties outside Painter

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by allistar >> Thu, 29 Jan 2004 3:22:50 GMT

Hi there,
I doubt this is supported, so don't expect Jade to help if you stuff your database, but we have used this menthod many times before and it sure saves some tedious work, especially if updating hundreds of forms/controls at once.

You won't be able to change the name of a control using this method.

Try this code, which changes the caption on a control called "label1" on form "SomeForm" to "blah". This is changing the actual persistent control, not the transient instance. I.e. if you open up the form in the painter you will see this change:

vars
control, persistentControl: Control;
form: SomeForm;begin

create form transient;
persistentControl := form.label1.getPersistentObject().Control;
beginTransaction;
persistentControl.setPropertyValue("caption", "blah");
commitTransacion;
end;

IMPORTANT: After modifying a persistent form instance like this you must open that form in the painter and save it. This builds the binary for the form that is sent to thin clients (which from my understanding is much more efficient than sending the control instances down).

Be careful when doing stuff like this, you could do some damage if you are not careful,

Regards,
Allistar.
--
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

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

Re: Updating Control Properties outside Painter

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by Dr J. >> Thu, 29 Jan 2004 3:35:40 GMT

As Allistar has said, you need to save a form to get the binary for that form rebuilt or your programmatic change will not be reflected in the form displayed at runtime. If you change a large number of forms you can save time and effort by saving a common superform. If you don't have a common superform another option to save individually opening and saving each form in painter is to perform a selective extract and load of the forms as the binary is rebuilt during a schema load.

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

Re: Updating Control Properties outside Painter

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by Paul Mathews - C&M Systems Group >> Thu, 29 Jan 2004 20:52:42 GMT

Thankyou both, I am using it to get away from .hlp files and ensuring the help viewer also enables me to update, descriptions and help text.

Advantages of this approach:


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests