Brenda,
It's not defining a class on the fly, it is adding an instance (object) to the page at runtime. If you wanted that line object to have a click method you'd have to create a subclass of Line and put the code in it's Click() method. Then you'd just tell it to add an object based on your subclass:
create classlib YourClasslib
create class YourLineSubclass of YourClasslib as Line
add your click method
then in your code:
set classlib to YourClassLib additive
this.AddObject( "JustALine", "YourLineSubclass" )
>copied this from last week and it works great. have an additional question that may seem strange. i am a new vfp programmer and do not know how to do many simple things nor do i know the terminology. My questions is, you defined a class based on a line "on the fly". if i wanted to code something for ounderline.click, how would i do that. what is the syntax for adding method code to an object defined in code?