Subject: | Re: Code in reports - hilight item DO NOT PASTE OBJECTS
| Date: | Thu, 29 Mar 2018 15:58:38 -0500
| From: | Mark Bannister <markRemove@THISinjection-moldings.com>
| Newsgroups: | pnews.paradox-development
|
I almost forgot.
DO NOT PASTE OBJECTS IN THE REPORT OR IT WILL WIPE OUT ALL OF YOUR
CODE!!!!!!!!!
You can paste in the code window itself.
On 3/29/2018 3:38 PM, Mark Bannister wrote:
> It's tricky. And I'm running through this fast.....
>
> You have to have the floating panels turned on (one of the better parts
> of proview I think).
> Right click on the "RV" button and select the "Simple Floating Panel".
> Now click on the object your want to add code to and then click the
> "Method Edit" button on the floating panel (6th button). It pops up a
> list of methods. Click the one your want or add a new method.
> There are some issues about where you add code ( proview will warn you
> about them).
> UI objects run their code in the same order they are displayed, so while
> your can call a method in another object it may not have executed yet so
> variables may not be set yet, etc.
> I put almost all my code in the tableframe (or the first table frame)
> and lower objects can usually see that.
> You can open libraries and use them but you need to make sure your first
> object opens the libraries (or have all objects make sure they are
> open). I put the library vars in the tableframe, create a method that
> opens them, and then call that method from every other method running code.
> To trigger custom methods use calculated fields. The value in the
> calculated field can be a dummy value but the calculated field must pass
> a value or it won't trigger.
> For instance some people create a dummy object to open libraries and
> initialize variables. The place it as the first object in the
> tableframe and make it a calculated field.
> Dummy objects calc field: openlibs( [datamodelalias:myvalue])
>
> ;// var of table frame
> Var
> myvariables sometype
> mylibraries library
>
> testvar longint
> endvar
>
> Method Openlibs( dummy longint)
>
> ;// open in libraries
> ;// init global variables
> ;/// perhpas calculate your counts here
>
> testvar = 99 ;<<< set global var to a value
>
> endmethod
>
> ;// another method to access testvar
> Method getTestVar( dummy longint ) longint
> return testvar
> endmethod
>
> You can also address the global variables in calculated fields
> some calc field: iif([datamodelalias:myvalue]=1, testvar, testvar2 )
>
>
> On 3/29/2018 1:38 PM, Kevin Baker wrote:
>> Mark,
>>
>> Ok, so now I'm just curious about the code on a report. You mentioned
>> using Proview is the easiest way, but I can't seem to figure out to do
>> it. Is this still possible in the latest version of Proview?
>>
>> Thanks
>> Kevin
>>
>> "Mark Bannister" wrote in message
>> news:421e3557$1@pnews.thedbcommunity.com...
>>
>> janM wrote:
>>> Mark
>>>
>>> Just for the record...
>>>
>>> How do you put code to the object of your report without causing GPV,
>>> etc...
>>>
>>> In P9: this is my way:
>>> - first put the objects in place on the report
>>> - then create a blank - new form
>>> - copy the necessary objects to the form and add code to it
>>> - last: paste them back in place in the report
>>>
>>> Perhaps there is a better way?
>>>
>>
>> Of course there is a better way <g>. Use Vladimir's Proview. It allows
>> for editing report methods. It also blocks you from putting code in the
>> most unstable places.
>> You can also do it with opal code and the editmethod method. Use a
>> script or form to run the editmethod code. Proview is the easiest way.
>> Mark B.
>> PS Remember when adding code to reports to always save before running.
>> Code changes do not take effect unless you save it.
>
|