DVL Software Limited
[ About | Services | Products | Search | Feedback | Support ]

PowerBuilder Tips

Readonly parameters on events can cause problems

Back to the Tips


I'm using 32bit PB 5.00.02 (we can't upgrade this project yet) under NT4.  And I've found a really annoying problem with readonly variables.  We've declared a user event with two string parameters on a datawindow.  If we pass the strings by value, all works as expected.  If we pass the strings as readonly, we get really funny stuff (yes, that's a technical term) going on.

When assigning a value to a variable, the value is assigned to two variables. ie. A=B results in A being assigned the value of B and C being assigned the value of B.  A being a local variable and C being an instance variable defined in this ancestor.   Very strange indeed.

It's almost as if it thinks it's passing by reference, but getting the offsets incorrect.

That said, the advantages of readonly parameters are not to be under estimated.   You can avoid nasty surprises and self-document your code by denoting those parameters which are truely input-only as readonly.


Back to the Tips

[ About | Services | Products | Search | Feedback | Support ]

This page last updated: Wednesday, 23 February 2000
Copyright 1997, 1998, 1999, 2000 DVL Software Limited.  All rights reserved.