Gentlemen, I have a weird problem that I have solved but not using the way I wanted it to work:
1. Container which has textboxes, comboboxes in it the whole container being a class. No controlsources bound to the class at designtime.
Container has a property added to it called oData with an assign method.
2. Form holding the class has a private datasession with a grid on the form containing the data record by record which needs to be displayed in the container.
3. In the grid rowcolchange method the data from the current record is scattered directly to a form property object oData which is immediately assigned to the oData Property in the container - so there is one form data object that the container can see through the oData property of its own.
4. In the container, the assign method of oData binds the various field "controlSource" in the object to the properties of the container oData.
Example: This.txtId.controlsource = "This.odata.id"
5. When run ... and debugged line by line into the assign method of oData in the container, VFP complains that oData (the container oData not the form oData) cannot be found despite the fact that if you specify it in the watch list it can be seen perfectly and the program continues without problem or further errors if the error is ignored. The same error occurs regardless of debug being used.
I have found a way around the problem by not doing the double assign i.e. the scatter into the form property oData and then simply binding the controls in the container in the assign statement to <<control>>.Controlsource="Thisform.oData.<<property>>". Although it works I really want to make the assignments non specific so I can pass an object reference from anywhere but at least it solves the problem short term. Anyone any ideas?
If you want an example of this then I can post up a link.
Dave
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Hi Dave:
This is the problem:
This.txtId.controlsource = "This.odata.id"
Because from the txtId control perspective, it haven't any "odata" property when evaluates "this.odata" (or "my.odata" looking from txtId), and that's why thisform works.
You may use this:
This.txtId.controlsource = "This.parent.odata.id"
2016-10-24 9:26 GMT+02:00 Dave Crozier DaveC@flexipol.co.uk:
Gentlemen, I have a weird problem that I have solved but not using the way I wanted it to work:
Container which has textboxes, comboboxes in it the wholecontainer being a class. No controlsources bound to the class at designtime.
Container has a property added to it called oData with an assign method.
Form holding the class has a private datasession with a grid onthe form containing the data record by record which needs to be displayed in the container.
In the grid rowcolchange method the data from the current recordis scattered directly to a form property object oData which is immediately assigned to the oData Property in the container - so there is one form data object that the container can see through the oData property of its own.
In the container, the assign method of oData binds the variousfield "controlSource" in the object to the properties of the container oData.
Example: This.txtId.controlsource = "This.odata.id"
When run ... and debugged line by line into the assign method ofoData in the container, VFP complains that oData (the container oData not the form oData) cannot be found despite the fact that if you specify it in the watch list it can be seen perfectly and the program continues without problem or further errors if the error is ignored. The same error occurs regardless of debug being used.
I have found a way around the problem by not doing the double assign i.e. the scatter into the form property oData and then simply binding the controls in the container in the assign statement to <<control>>.Controlsource="Thisform.oData.<<property>>". Although it works I really want to make the assignments non specific so I can pass an object reference from anywhere but at least it solves the problem short term. Anyone any ideas?
If you want an example of this then I can post up a link.
Dave
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Fernando's solution ought to work, but I'd like to point out you are instantiating an object in a container that duplicates an object on the form that is a copy of a record in a table whose current values are shown in a grid that comes from a recordsource held in the Data Environment of a form.
FoxPro has this thing called cursors which can support buffering and transactions and can be presented to visual controls through data environments, views and cursoradaptors. You've got a lot of reinventing to do to duplicate all that power.
Curious why the built-in functionality doesn't work for you.
On Mon, Oct 24, 2016 at 3:38 AM, Fernando D. Bozzo fdbozzo@gmail.com wrote:
Hi Dave:
This is the problem:
This.txtId.controlsource = "This.odata.id"
Because from the txtId control perspective, it haven't any "odata" property when evaluates "this.odata" (or "my.odata" looking from txtId), and that's why thisform works.
You may use this:
This.txtId.controlsource = "This.parent.odata.id"
2016-10-24 9:26 GMT+02:00 Dave Crozier DaveC@flexipol.co.uk:
Gentlemen, I have a weird problem that I have solved but not using the way I wanted it to work:
Container which has textboxes, comboboxes in it the wholecontainer being a class. No controlsources bound to the class at designtime.
Container has a property added to it called oData with an assign method.
Form holding the class has a private datasession with a grid onthe form containing the data record by record which needs to be displayed in the container.
In the grid rowcolchange method the data from the current recordis scattered directly to a form property object oData which is immediately assigned to the oData Property in the container - so there is one form data object that the container can see through the oData property of its own.
In the container, the assign method of oData binds the variousfield "controlSource" in the object to the properties of the container oData.
Example: This.txtId.controlsource = "This.odata.id"
When run ... and debugged line by line into the assign method ofoData in the container, VFP complains that oData (the container oData not the form oData) cannot be found despite the fact that if you specify it in the watch list it can be seen perfectly and the program continues without problem or further errors if the error is ignored. The same error occurs regardless of debug being used.
I have found a way around the problem by not doing the double assign i.e. the scatter into the form property oData and then simply binding the controls in the container in the assign statement to <<control>>.Controlsource="Thisform.oData.<<property>>". Although it works I really want to make the assignments non specific so I can pass an object reference from anywhere but at least it solves the problem short term. Anyone any ideas?
If you want an example of this then I can post up a link.
Dave
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]