Discussion:
changing grid.editorType on the fly
(too old to reply)
Greg Hill
2008-09-25 06:47:43 UTC
Permalink
It appears that the columns editorType property is readonly? I have made
attempts to change to no avail.

I would hope that I am over looking something?

If it is infact readOnly it defeats the purpose of allowing the Grid to be
altered, because some editorTypes will not match up after manipulating the
Grid.

See dBASE Online help for "getColumnOrder( ) EXAMPLE"

I am currently getting around it by forcing all editorTypes to be type 1,
this way the initial re-creation of the grid properties doesn't throw an
error.

Anyone have any input on this?

Thank you in advance,

Greg Hill
Graham Monk
2008-09-25 21:35:06 UTC
Permalink
Hi Greg,

I build grid columns programmatically in one case and set the editorType,
from a control file which seems to work fine:

form.grMain.columns[cColumn].editorType :=
rsConfig.fields['editorType'].value

However, I am setting other properties after this such as width,
colorNormal, function, picture, ... I also set the dataLink before the
editorType.

Hope this helps, if not let me know and I will try a turnkey or you can post
one for me to try.

Regards,
Graham
Post by Greg Hill
It appears that the columns editorType property is readonly? I have made
attempts to change to no avail.
I would hope that I am over looking something?
If it is infact readOnly it defeats the purpose of allowing the Grid to be
altered, because some editorTypes will not match up after manipulating the
Grid.
See dBASE Online help for "getColumnOrder( ) EXAMPLE"
I am currently getting around it by forcing all editorTypes to be type 1,
this way the initial re-creation of the grid properties doesn't throw an
error.
Anyone have any input on this?
Thank you in advance,
Greg Hill
Greg Hill
2008-09-26 05:14:30 UTC
Permalink
I have code that is exactly as you describe.
I went into the debugger and found that I even though I though I was
changing the editorType to something new, infact I was "not". It just
running the code because the statement was returning true. Another words it
was comparing the values not changing them.
Are you sure you changing them?

Greg Hill

----- Original Message -----
From: "Graham Monk" <***@astutesoftware.co.nz>
Newsgroups: dbase.programming
Sent: Thursday, September 25, 2008 2:35 PM
Subject: Re: changing grid.editorType on the fly
Post by Graham Monk
Hi Greg,
I build grid columns programmatically in one case and set the editorType,
form.grMain.columns[cColumn].editorType :=
rsConfig.fields['editorType'].value
However, I am setting other properties after this such as width,
colorNormal, function, picture, ... I also set the dataLink before the
editorType.
Hope this helps, if not let me know and I will try a turnkey or you can post
one for me to try.
Regards,
Graham
Post by Greg Hill
It appears that the columns editorType property is readonly? I have made
attempts to change to no avail.
I would hope that I am over looking something?
If it is infact readOnly it defeats the purpose of allowing the Grid to be
altered, because some editorTypes will not match up after manipulating the
Grid.
See dBASE Online help for "getColumnOrder( ) EXAMPLE"
I am currently getting around it by forcing all editorTypes to be type 1,
this way the initial re-creation of the grid properties doesn't throw an
error.
Anyone have any input on this?
Thank you in advance,
Greg Hill
Graham Monk
2008-09-26 05:54:11 UTC
Permalink
In the form I only have one column defined because that is always there, see
below. Then I programmatically define the rest. However, I only do
"form.grMain.columns[cColumn] = new GRIDCOLUMN(form.grMain)" once because I
had problems when I did a release and redefined the col.

I will spend more time on it later.

Graham

this.GRMAIN = new ASIGRID(this)
with (this.GRMAIN)
onLeftMouseDown = class::Drag_onLeftMouseDown
onLeftDblClick = class::PROGRAMMING
dataLink = form.dmplus.qplus.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.GRMAIN)
columns["COLUMN1"].dataLink =
form.dmplus.qplus.rowset.fields["record_no"]
columns["COLUMN1"].editorType = 1 // EntryField
columns["COLUMN1"].width = 7.0
with (columns["COLUMN1"].editorControl)
picture = "99999"
fontName = ""
endwith

with (columns["COLUMN1"].headingControl)
function = "J"
fontName = ""
value = "Rec #"
endwith

allowAddRows = false
height = 17.90
left = 1.7143
top = 0.65
width = 95.0
endwith
Post by Greg Hill
I have code that is exactly as you describe.
I went into the debugger and found that I even though I though I was
changing the editorType to something new, infact I was "not". It just
running the code because the statement was returning true. Another words it
was comparing the values not changing them.
Are you sure you changing them?
Greg Hill
----- Original Message -----
Newsgroups: dbase.programming
Sent: Thursday, September 25, 2008 2:35 PM
Subject: Re: changing grid.editorType on the fly
Post by Graham Monk
Hi Greg,
I build grid columns programmatically in one case and set the editorType,
form.grMain.columns[cColumn].editorType :=
rsConfig.fields['editorType'].value
However, I am setting other properties after this such as width,
colorNormal, function, picture, ... I also set the dataLink before the
editorType.
Hope this helps, if not let me know and I will try a turnkey or you can post
one for me to try.
Regards,
Graham
Post by Greg Hill
It appears that the columns editorType property is readonly? I have made
attempts to change to no avail.
I would hope that I am over looking something?
If it is infact readOnly it defeats the purpose of allowing the Grid to be
altered, because some editorTypes will not match up after manipulating the
Grid.
See dBASE Online help for "getColumnOrder( ) EXAMPLE"
I am currently getting around it by forcing all editorTypes to be type 1,
this way the initial re-creation of the grid properties doesn't throw an
error.
Anyone have any input on this?
Thank you in advance,
Greg Hill
Greg Hill
2008-09-26 06:52:38 UTC
Permalink
Post by Graham Monk
Hi Greg,
I build grid columns programmatically in one case and set the editorType,
form.grMain.columns[cColumn].editorType :=
rsConfig.fields['editorType'].value
However, I am setting other properties after this such as width,
colorNormal, function, picture, ... I also set the dataLink before the
editorType.
Hope this helps, if not let me know and I will try a turnkey or you can post
one for me to try.
Ok, this helped. When say you build them programmatically, I got the idea
to abort the base GRID1 that is already defined in the forms construct code.
Then with a small addition to the code that restores the grid as it was the
last time they had it opened, I got it working.

So, the code I added was to create the complete grid from scratch but in the
case that they never opened it, it will go the a routine that creates it
based on the hard coded version.

Working like a charm, I do believe that once the grid is created the
"editorType" property is readOnly. But that is not a big deal now that I am
creating it from scratch :-)

Thank you,

Greg Hill

Loading...