Forum > Packages and Libraries
TKGrid dom't show checkbox status
(1/1)
eldonfsr:
Hi i made a form using TKGrid but i made some wrong because don't show me at first row status of checbox , but on next rows show me status could be erro when status unchecked but when is cheked show me on cell...
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFormMain.TabSSourcesShow(Sender: TObject);Var Row,Col:Integer; Cell: TMyTextCell; RowGrid:Array[0..11] of integer; begin {$IFNDEF MSWINDOWS} KGrid1.DefaultRowHeight := 34;{$ENDIF} KSTGSources.DoubleBuffered := True;{$IFDEF MSWINDOWS} // In Windows Vista and 7 this is much more nicer if Win32MajorVersion >= 6 then KSTGSources.OptionsEx := KSTGSources.OptionsEx + [gxFixedThemedCells];{$ENDIF} RowGrid[0]:=4; RowGrid[1]:=8; RowGrid[2]:=11; RowGrid[3]:=15; RowGrid[4]:=19; RowGrid[5]:=23; RowGrid[6]:=27; RowGrid[7]:=31; RowGrid[8]:=35; RowGrid[9]:=39; RowGrid[10]:=45; RowGrid[11]:=47; if( DM.SQLQSources.Active = false) then begin DM.SQLQSources.ParamByName('ppnid').AsInteger:= BDproduct.FieldByName('pnid').AsInteger; DM.SQLQSources.open; end else begin DM.SQLQSources.close; DM.SQLQSources.ParamByName('ppnid').AsInteger:= BDproduct.FieldByName('pnid').AsInteger; DM.SQLQSources.open; end;// KSTGSources.RealizeCellClass; KSTGSources.RowCount:= DM.SQLQSources.RecordCount *3 +DM.SQLQSources.RecordCount+3 ; KSTGSources.CellClass := TMyTextCell;// KSTGSources.PageSetup.Title := 'KGridDemo table';// KSTGSources.PageSetup.UnitHeaderSpace := 1; //we want to print a custom header, cm is default// KSTGSources.RangeSelectStyle := rsMultiSelect; KSTGSources.Cells[1, 0] := 'Vendor'; KSTGSources.Cells[2, 0] := 'Mfr'; KSTGSources.Cells[4, 0] := 'Cost'; KSTGSources.Cells[5, 0] := 'Primary'; KSTGSources.Cells[1, 1] := 'Vendor P/N'; KSTGSources.Cells[2, 1] := 'Mfr P/N'; KSTGSources.Cells[4, 1] := 'Buy As'; KSTGSources.Cells[5, 1] := 'Choice'; KSTGSources.Cells[1, 2] := 'Description'; KSTGSources.CellSpan[2, 2]:=MakeCellSpan(1, 2); KSTGSources.Cells[2, 2]:='Lead Time' ;// STGSources.CellSpan[3, 2]:=MakeCellSpan(1, 2);// STGSources.Cells[3, 2] := 'Lead Time '; KSTGSources.CellSpan[3, 2]:=MakeCellSpan(1, 2); KSTGSources.Cells[3, 2] := ' RFQ Date '; KSTGSources.Cells[4, 2] := 'Atlevel'; KSTGSources.Cells[5, 2] := 'Multipleof'; KSTGSources.ColWidths[0] := 20; KSTGSources.ColWidths[1] := 150; KSTGSources.ColWidths[2] := 150; KSTGSources.ColWidths[3] := 80; KSTGSources.ColWidths[4] := 80; KSTGSources.ColWidths[5] := 80; Row:=0 ; Col:=0 ;// while (not DM.SQLQSources.eof ) do begin// Row:= RowGrid[DM.SQLQSources.RecNo-1];// Cell := TMyTextCell.Create(nil);// try// Cell.Text := '0';// Cell.CheckBoxState := cbUnChecked;// KSTGSources.Cell[5, Row] := Cell; // Cell is copied, we must destroy it// finally// Cell.Free;// end;// DM.SQLQSources.next;// end; Row:=4 ; Col:=0 ; DM.SQLQSources.first; while(not DM.SQLQSources.eof) do begin KSTGSources.Cells[Col, Row] := Inttostr(DM.SQLQSources.RecNo); KSTGSources.Cells[1, Row] := DM.SQLQSources.FieldByName('SuSupplier').AsString; KSTGSources.Cells[2, Row] := DM.SQLQSources.FieldByName('lnkMFRid').AsString; KSTGSources.Cells[4, Row] := DM.SQLQSources.FieldByName('lnkcurrentcost').AsString; Cell := TMyTextCell.Create(nil); try Cell.Text := DM.SQLQSources.FieldByName('LnkUse').AsString; if( DM.SQLQSources.FieldByName('LnkUse').AsInteger =1) then begin Cell.CheckBoxState := cbChecked; end else begin Cell.CheckBoxState := cbUnChecked; end; KSTGSources.Cell[5, Row] := Cell; // Cell is copied, we must destroy it finally Cell.Free; end; Inc(Row); KSTGSources.Cells[1, Row] := DM.SQLQSources.FieldByName('lnkvendorpn').AsString; KSTGSources.Cells[2, Row] := DM.SQLQSources.FieldByName('lnkvendorpn').AsString; KSTGSources.Cells[4, Row] := DM.SQLQSources.FieldByName('unuseunits').AsString; KSTGSources.Cells[5, Row] := DM.SQLQSources.FieldByName('lnkchoice').AsString; Inc(Row); KSTGSources.Cells[1, Row] := DM.SQLQSources.FieldByName('lnkvendordesc').AsString; KSTGSources.Cells[2, Row] := DM.SQLQSources.FieldByName('lnkleadtime').AsString ; KSTGSources.Cells[3, Row] := DM.SQLQSources.FieldByName('lnkrfqdate').AsString ; KSTGSources.Cells[4, Row] := DM.SQLQSources.FieldByName('lnkatqty').AsString; KSTGSources.Cells[5, Row] := DM.SQLQSources.FieldByName('lnkminincrement').AsString; Inc(row); Inc(row); Col:=0 ; DM.SQLQSources.Next; end; end; you can se image how is show when get fos con cell and how show when lose focus on cell at 4 row col 5...
Navigation
[0] Message Index