Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Matt Pegg
  Where is Matt Pegg?
 Ballarat
 Australia
 Matt Pegg
 Tags
Subject: Width_assign method fires on access ?
Thread ID: 200823 Message ID: 200823 # Views: 32 # Ratings: 0
Version: Not Applicable Category: Classes and Objects
Date: Thursday, October 30, 2008 2:09:06 AM         
   


Hi all,

I have a problem at the moment in that it appears if I have an Assign
method on either the Width or Height property of a Control, that assign
method is executed when the property is accessed.

If I have both assign & access methods, then assign will fire when
I set the property, but BOTH access and assign will fire when I read
the property.

I've tested this on Labels, Containers and Textboxes in VFP 9 & 6, and
it happens in all cases - only for Width and Height though.

Anyone have an idea as to why ?

eg.
DEFINE CLASS TestLabel AS Label

   PROCEDURE Width_ACCESS 
      MESSAGEBOX("Label Width Access")
      RETURN THIS.Width
  ENDPROC
   
   PROCEDURE Width_ASSIGN 
      LPARAMETERS vNewVal
      MESSAGEBOX("Label Width Assign")
      THIS.Width = m.vNewVal
   ENDPROC

ENDDEFINE

m.lnWidth = THISFORM.TestLabel1.Width


will result in both Messages being displayed.
Note: Assign will fire whether Access exists or not, and the reverse doesnt happen.
ie. Access doesnt (and shouldnt) fire when we set the property.

cheers,
Matt.



COMPLETE THREAD
Width_assign method fires on access ? Posted by Matt Pegg @ 10/30/2008 2:09:06 AM
RE: Width_assign method fires on access ? Posted by Andy Kramek @ 10/30/2008 2:45:04 AM
RE: Width_assign method fires on access ? Posted by Matt Pegg @ 10/30/2008 4:27:42 AM