Hi,
I want to get or set an ItemIndex from a ComboBoxColumn cell in NextGrid6, but I can not find the ItemIndex property.
How is everyone doing?
Is there a demo to be helpful?
Posted 17 February 2018 - 08:38 PM
Hi,
I want to get or set an ItemIndex from a ComboBoxColumn cell in NextGrid6, but I can not find the ItemIndex property.
How is everyone doing?
Is there a demo to be helpful?
Posted 17 February 2018 - 09:20 PM
Posted 18 February 2018 - 08:34 PM
Hi Boki,
Thanks to you, I solved it.
function GetNxGrdItemIdx(grd: TNextGrid6;ACol, ARow: Integer):integer; var OwnerCom: TComponent; clmn: TNxComboBoxColumn6; i: Integer; begin Result := -1; OwnerCom := grd.Owner; if grd.Columns[ACol].ClassName = 'TNxComboBoxColumn6' then begin for i := 0 to OwnerCom.ComponentCount-1 do if OwnerCom.Components[i] is TNxComboBoxColumn6 then begin if TNxComboBoxColumn6(OwnerCom.Components[i]).Index = ACol then begin clmn := TNxComboBoxColumn6(OwnerCom.Components[i]); Result := clmn.Items.IndexOf(grd.Cell[ACol, ARow].asString); Break; end; end; end else if grd.Columns[ACol].ClassName = 'TNxListColumn6' then Result := grd.Cell[ACol, ARow].AsInteger; end; function SetNxGrdItemIdx(grd: TNextGrid6;ACol, ARow, idx: Integer):Boolean; var OwnerCom: TComponent; clmnC: TNxComboBoxColumn6; clmnL: TNxListColumn6; i: Integer; begin Result := False; OwnerCom := grd.Owner; if grd.Columns[ACol].ClassName = 'TNxComboBoxColumn6' then begin for i := 0 to OwnerCom.ComponentCount-1 do if OwnerCom.Components[i] is TNxComboBoxColumn6 then begin if TNxComboBoxColumn6(OwnerCom.Components[i]).Index = ACol then begin clmnC := TNxComboBoxColumn6(OwnerCom.Components[i]); if idx > clmnC.Items.Count-1 then Break; if idx < 0 then grd.Cells[ACol, ARow] := '' else grd.Cells[ACol, ARow] := clmnC.Items[idx]; Result := True; Break; end; end; end else if grd.Columns[ACol].ClassName = 'TNxListColumn6' then begin for i := 0 to OwnerCom.ComponentCount-1 do if OwnerCom.Components[i] is TNxListColumn6 then begin if TNxListColumn6(OwnerCom.Components[i]).Index = ACol then begin clmnL := TNxListColumn6(OwnerCom.Components[i]); if Idx > clmnL.Items.Count-1 then Break; grd.Cell[ACol, ARow].AsInteger := idx; Result := True; Break; end; end; end; end;
0 members, 1 guests, 0 anonymous users