Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox in grid behaving abnormaly 1

Status
Not open for further replies.

Koen Piller

Programmer
Jun 30, 2005
841
0
0
NL
Hi,

I have created a dynamic grid with first column a checkbox with following code:

grid init:
&& to enable dynamic grid sorting functionality
Code:
for each loColumn in this.Columns
    for each loControl in loColumn.Controls
        if lower(loControl.Baseclass)='header'
           bindevent(loControl,'Click',this,'cSortField')
        endif
    endfor
endfor

with this.Column1
    .RemoveObject('Text1')
    .AddObject('chkBox','grdchkBox') &&checkbox with some functionality from my 'GrdchkBox' Class
    .CurrentControl = 'chkBox'
    .ControlSource = 'lSelect'  &&a logical field from my cursor
    .Sparse = .f.
    .Enabled = .t.
endwith
now when running a form with this Grid, the checkbox value cannot be changed and remains as is.

I have added in "afterRowColChange"
Code:
with thisform.myGrid1
if .ActiveColumn = 1
   lValue = .Column1.chkBox.Value
   .Column1.chkBox.value = !lValue
endif
endwith

and the checkbox's value can be changed.

However I dont seem to be able to figure out how to change this coding for rightclick - to enable the enduser to change all the checkboxes from .f. to .t. i.o.w. to select everything. Any ideas are welcome

Jockey2
 
Set CheckBox Visisble = .t.. All objects which are added programaticly and unvisible by default:[
Code:
with this.Column1
    .RemoveObject('Text1')
    .AddObject('chkBox','grdchkBox') &&checkbox with some functionality from my 'GrdchkBox' Class
    .chkBox.Visible = .t.
    .CurrentControl = 'chkBox'
    .ControlSource = 'lSelect'  &&a logical field from my cursor
    .Sparse = .f.
    .Enabled = .t.
endwith

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
Boris,

that did it! Thanks a lot. - Strange I can also literaly see the checkbox without the .chkbox.Visible = .t. Now with this property on .T. I cannot even see but also work with it. Thanks a lot.

Jockey2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top