2013-03-04 43 views

回答

4

您的表單/網格OnGetValue事件處理程序將作爲其參數之一傳遞該行。只需驗證該列是否是您想要的並返回行號。

function Form1.Grid1GetValue(const Row, Col: Integer): TValue; 
begin 
    if Col = 0 then 
    Result := TValue.From<Integer>(Row); 
end; 
+0

感謝您指引我在正確的方向。我有Delphi XE2,所以這個事件沒有實現。我修改了FMX.Grid的TStringGrid.GetValue來調用FOnGetValue並在代碼中分配了事件處理程序,並且它可以工作。 – 2013-03-04 22:04:13

+0

您在XE2中仍然有事件,但它返回Variant而不是TValue。 – 2013-03-04 23:11:47

+0

它在那裏,但它沒有實現。它從未被調用過,也沒有暴露過。我實現了它。謝謝。 – 2013-03-05 13:09:27