|
|
 | | From: | Glenn | | Subject: | Beforegetvalue inconsistency | | Date: | Mon, 06 Dec 2004 17:57:40 -0500 |
|
|
 | I traced this as far back as db2K. Add a new field in the rowset's onopen event, assign a beforegetvalue. Works fine. If you design the form, it is also placed in the with...endwith structure of the rowset. Now, change the OnOpen's beforegetvalue method. It is not recognized. Design the form, it is still not recognized. You have to manually delete the old one before the new gets loaded. Personally, I don't see why the need for both locations.
Thanks,
Glenn Fausel
|
|
 | | From: | Glenn | | Subject: | Re: Beforegetvalue inconsistency | | Date: | Fri, 17 Dec 2004 18:10:29 -0500 |
|
|
 | Glenn wrote: > I traced this as far back as db2K. Add a new field in the rowset's > onopen event, assign a beforegetvalue. Works fine. If you design the > form, it is also placed in the with...endwith structure of the rowset. > Now, change the OnOpen's beforegetvalue method. It is not recognized. > Design the form, it is still not recognized. You have to manually delete > the old one before the new gets loaded. Personally, I don't see why the > need for both locations. > > Thanks, > > Glenn Fausel >
I guess this is not a bug given the response. WAD?? Doubt it.
Glenn
|
|
 | | From: | Marty Kay | | Subject: | Re: Beforegetvalue inconsistency | | Date: | Sat, 18 Dec 2004 00:14:31 -0500 |
|
|
 | Glenn,
> I guess this is not a bug given the response. WAD?? Doubt it.
It sounds like there is a problem here.
Would you have a test case you can post?
If not, we will do our best to reproduce it.
Thanks,
- Marty Kay (dBI) -
|
|
 | | From: | Glenn | | Subject: | Re: Beforegetvalue inconsistency | | Date: | Mon, 20 Dec 2004 20:20:28 -0500 |
|
|
 | Here is an example, watch line-wrap. Run form as is, works fine. Then,open it up in designer and you will see added to adam1
with (this.ADAM1.rowset) fields["Middlename"].beforeGetValue = {||"Sam"} endwith
Now, change "Sam" to "Jane" or whatever in the OnOpen function. Run it, it still says Sam. Design it, it does not change Sam to Jane. You have to physically change it in both locations.
Thanks,
Glenn
set database to close tables if file("adam.dbf") drop table "adam.dbf" endif create table "adam.dbf"(; name char(10),; surname char(10)) insert into adam values ("Tom","Newton") insert into adam values ("Bill","Smith") insert into adam values ("Adam","Sheridan") insert into adam values ("John","Smith") insert into adam values ("Marko","Mihorko") create index name on 'adam.dbf' (name) create index surname on 'adam.dbf' (surname) ** END HEADER -- do not remove this line // // Generated on 12/20/2004 // parameter bModal local f f = new bgetvalForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif
class bgetvalForm of FORM with (this) height = 16.1364 left = 35.0 top = 0.0 width = 59.2857 text = "Adam" endwith
this.ADAM1 = new QUERY() this.ADAM1.parent = this with (this.ADAM1) onOpen = class::ADAM1_ONOPEN left = -0.1429 top = -0.0455 sql = 'select * from "adam.dbf"' active = true endwith
this.GRID1 = new GRID(this) with (this.GRID1) dataLink = form.adam1.rowset columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1) columns["COLUMN1"].dataLink = form.adam1.rowset.fields["name"] columns["COLUMN1"].editorType = 1 // EntryField columns["COLUMN1"].width = 14.2857 columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1) columns["COLUMN2"].dataLink = form.adam1.rowset.fields["surname"] columns["COLUMN2"].editorType = 1 // EntryField columns["COLUMN2"].width = 14.2857 columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1) columns["COLUMN3"].dataLink = form.adam1.rowset.fields["middlename"] columns["COLUMN3"].editorType = 1 // EntryField columns["COLUMN3"].width = 35.7143 with (columns["COLUMN1"].headingControl) value = "name" endwith
with (columns["COLUMN2"].headingControl) value = "surname" endwith
with (columns["COLUMN3"].headingControl) value = "Middlename" endwith
height = 6.5 left = 3.0 top = 1.0 width = 51.0 endwith
this.rowset = this.adam1.rowset
function adam1_onOpen c = new Field() c.fieldName := "Middlename" this.rowset.fields.add(c) c.beforeGetValue := {||"Sam"}
return
endclass
|
|
 | | From: | Marty Kay | | Subject: | Re: Beforegetvalue inconsistency | | Date: | Tue, 21 Dec 2004 13:35:39 -0500 |
|
|
 | Glenn,
Ok.
I ran your test case and I saw the *extra* code automatically added when opening the source editor within the Form Designer.
You can prevent the *extra* code from being automatically added by testing form.inDesign in your onOpen code as follows:
function adam1_onOpen c = new Field() c.fieldName := "Middlename" this.rowset.fields.add(c)
if not form.inDesign // don't assign beforeGetValue when in form designer c.beforeGetValue := {||"Sam"} endif
return
By using form.inDesign you are leaving the field's beforeGetValue property null. When the Form Designer restreams the source code to make it readable in the Source Editor, it won't find anything to stream for the beforeGetValue property.
- Marty Kay (dBI) -
|
|
 | | From: | Glenn | | Subject: | Re: Beforegetvalue inconsistency | | Date: | Tue, 21 Dec 2004 14:26:58 -0500 |
|
|
 | Marty Kay wrote: > Glenn, > > Ok. > > I ran your test case and I saw the *extra* code automatically added when > opening the source > editor within the Form Designer. > > You can prevent the *extra* code from being automatically added by testing > form.inDesign > in your onOpen code as follows: > > > function adam1_onOpen > c = new Field() > c.fieldName := "Middlename" > this.rowset.fields.add(c) > > if not form.inDesign // don't assign beforeGetValue when in > form designer > c.beforeGetValue := {||"Sam"} > endif > > return > > By using form.inDesign you are leaving the field's beforeGetValue property > null. > When the Form Designer restreams the source code to make it readable in the > Source Editor, it won't find anything to stream for the beforeGetValue > property. > > > - Marty Kay (dBI) - > > Thanks for the workaround, but I still think the fact that it does it the first time but does NOT do it again is a bug.
Glenn
|
|
|