|
Home > Archive > Programming with dBASE > October 2005 > beforecellpaint
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| paolo bentivegna 2005-10-07, 3:26 am |
| hi,
in event beforecellpaint i want to know the grid column number or column
name, is this possible ?
| |
| Marko Mihorko [dBVIPS] 2005-10-11, 7:27 am |
| Hello Paolo!
"paolo bentivegna" je napisal v sporočilo...
> in event beforecellpaint i want to know the grid column number or column
> name, is this possible ?
Hm, well, yes, as usual, just that in this case you have to jump a bit around
in order to achieve your goal... ;-)
Namely, the event "beforeCellPaint" fires too soon, so normally in its method
you would get returned the column number and the column name with regard to the
cell which you are coming from, and not at all the ones of the cell which you
are clicking at. ;-)
As usual mark/copy/paste/save everything below to a file named f.e. <Paolo.wfm>
and later on doubleclick on it under the <Forms> tab of the <Navigator> window.
Then click around on different cells in different rows/columns of the grid and
while doing that check as well the data shown in the Display Panel of the
<Command> window at that very moment...
Marko Mihorko [dBVIPS]
set database to; close tables
close tables
if file('Paolo_M.dbf'); drop table Paolo_M
endif
create table Paolo_M(paolo1 char(11), paolo2 char(11))
use paolo_M; gene 20;use
** END HEADER -- do not remove this line
//
// Generated on 09.10.2005
//
parameter bModal
local f
f = new PaoloForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class PaoloForm of FORM
with (this)
onOpen = {; form.grid1.refresh()}
text = "Paolo - beforecellpaint"
endwith
this.paolo_M1 = new QUERY()
this.paolo_M1.parent = this
with (this.paolo_M1)
sql = 'select * from "paolo_M.dbf"'
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.paolo_m1.rowset
height = 14.8
left = 1.0
top = 0.5
width = 38.0
endwith
this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
onGotFocus = {; form.grid1.setFocus()}
visible = false
endwith
this.rowset = this.paolo_m1.rowset
function open
dataFields = form.paolo_m1.rowset.fields
gridColumns = form.grid1.columns
gridColumns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
gridColumns["COLUMN1"].dataLink = dataFields["paolo1"]
gridColumns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
gridColumns["COLUMN2"].dataLink = dataFields["paolo2"]
with (form.grid1.columns["COLUMN1"].editorControl)
beforeCellPaint = class::EDITORCONTROL
_BEFORECELLPAINT
onGotFocus = class::EDITORCONTROL
_ONGOTFOCUS
endwith
with (form.grid1.columns["COLUMN2"].editorControl)
beforeCellPaint = class::EDITORCONTROL
_BEFORECELLPAINT
onGotFocus = class::EDITORCONTROL
_ONGOTFOCUS
endwith
return super::open()
function editorControl_onGotF
ocus
clear
form.entryfield1.setfocus()
return
function editorControl_before
CellPaint(bSelectedR
ow)
this.colorNormal = iif(this.value.isUpper(),"brown/white",;
"green/white")
? "Current grid's column number: " + this.parent.currentColumn
? " Current grid's column name: " + this.parent;
.columns[this.parent.currentColumn].headingControl.value
? " Current grid's cell value: " + this.value
return true
endclass
| |
| paolo bentivegna 2005-10-11, 7:27 am |
| thx
|
|
|
|
|