Page 1 of 1

Error in SetProperty()

Posted: Mon Oct 10, 2011 2:51 pm
by Ricci
SetProperty() isn“t working anymore.

That should be the same:

Code: Select all

Form_7:LabelY01:Value("")

SetProperty ( "Form_7", "LabelY01", "Value", "" )
But SetProperty() returns an error: Variable does not exist: Form_7
And after that error, the program must be closed via task manager.

Some days ago it workes quit well.

Re: Error in SetProperty()

Posted: Mon Oct 10, 2011 3:04 pm
by mrduck
First of all PLEASE don't use Set/GetProperty anymore, it is a HMG3-thing that is only partially ported to HMG4 and introduces some slowness - use only when strictly necessary... :-)
Ricci wrote:Some days ago it workes quit well.
I introduced some changes on september 19, so you should be more precise on "some days ago"... :-)

Anyway, you are sayint that using

Code: Select all

Form_7:LabelY01:Value("")
works correctly but if you put the following line AT THE SAME PLACE it doesn't work, right ?

Code: Select all

SetProperty ( "Form_7", "LabelY01", "Value", "" )
If you confirm, please have a look at misc.prg:

Code: Select all

FUNCTION SetProperty( cWindow , cControl , cProperty , xValue1, xValue2 )

   IF pcount() == 4
      &cWindow:&cControl:&cProperty := xValue1
      RETURN xValue1
The error that variable Form_7 doesn't exists let me think that Form_7 is LOCAL... visible to the OOP syntax, not visible to SetProperty....

Please try this:

Code: Select all

FUNCTION SetProperty( cWindow , cControl , cProperty , xValue1, xValue2 )

   IF pcount() == 4
      HMGAPP():&cWindow:&cControl:&cProperty := xValue1  // HERE IS THE CHANGE
      RETURN xValue1
and report.

With the change the window is not referenced by its variable but by its name. Not sure if there is a side-effect so I can't commit it now....

Re: Error in SetProperty()

Posted: Mon Oct 10, 2011 3:52 pm
by Ricci
mrduck wrote: The error that variable Form_7 doesn't exists let me think that Form_7 is LOCAL... visible to the OOP syntax, not visible to SetProperty....

Please try this:

Code: Select all

FUNCTION SetProperty( cWindow , cControl , cProperty , xValue1, xValue2 )

   IF pcount() == 4
      HMGAPP():&cWindow:&cControl:&cProperty := xValue1  // HERE IS THE CHANGE
      RETURN xValue1
and report.
With this change it work well.
And yes, Form_7 was definded as LOCAL.