Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding code programmatically
Message
From
11/10/2004 09:10:37
 
 
To
11/10/2004 08:40:19
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00950358
Message ID:
00950381
Views:
16
This message has been marked as a message which has helped to the initial question of the thread.
>>>Is it possible to add programmatically code in an Object event ?
>>>I'm trying to add a form containing a grid to a form set object, what i'd need to do is to manage the grid afterrowcolchange event adding code to it on fly. Actually i put a property in a form (the form i'm going to add), in which i store the command to execute (i.e. Thisformest.MyProcedure(ListOfParam) ) and i execute by this code i store in the AfterRowCoChange of the grid
>>>
>>>If !empty(thisform.property)
>>> strcom = thisform.property
>>> &strcom
>>>endif
>>>
>>>It works but in this way I can manage only a limited number of events.
>>>Any Idea ?
>>>I Hope I have explained the problem clearly !!
>>>
>>>Alessio
>>
>>Alessio,
>>
>>as far as I can see
>>
>>If !empty(thisform.property)
>> ReturnValue = eval(thisform.property)
>>endif
>>
>>
>>
>>You can also make it an array and loop
>>Something along these lines
>>
>>&& grid afterrow
>>local i
>>for i = 1 to this.nAddedCode
>>    if( !empty(this.AddedCode[m.i]) )
>>        = eval(this.AddedCode[m.i])
>>    endif
>>endfor
>>
>
>But in this way I have to put code in my Base Class where I think i'm going to use it. So if I want to execute code after an event i Have to prepare that event to accept it. That 's Just I wanted to avoid :-)
>What I was thinking of is to add code directly in an object event.....
>I understand that if I could write in my own language it would be much better :-)
>Thank you anyway.


Alessio,

The code above must be added to your baseclass along with the properties nAddedCode, AddedCode[] and a method to add code and one to remove code. This shouldn't be too difficult and there would not be much overhead. Also, this is the solution I prefer


You can also avoid putting the code in the baseclass provided you add the following to the init of the grid
this.AddProperty('nAddedCode', 0)
this.AddProperty('AddedCode[1]')
or maybe you can use BindEvent(). Then there's nothing to add to the baseclass
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform