Delphi - ControlListButton.OnClick - 如何從 ControlList 確定 AIndex
您好,我正在開發一個日歷表單,我正在嘗試查找 ControlList 中的 ControlListButton 的索引。在 BeforeDrawItem 中,Label.Caption 被設定為來自 ClientDataSet 的描述
ControlList.BeforeDrawItem 有一行使用 AIndex
procedure TFormCalendarViewMonthly.ControlListDayBeforeDrawItem(
AIndex: Integer; ACanvas: TCanvas; ARect: TRect; AState:
TOwnerDrawState);
begin
clientDataSet.RecNo:=AIndex;
etc..
end;
ControlListButtonClick 僅與 Sender 一起顯示。如何獲取在 BeforeDraw 期間創建的點擊的 AIndex?
IE。
procedure TFormCalendarViewMonthly.ControlListButtonClick(Sender:
TObject);
begin
//AIndex is not part of the procedure
end;
我應該使用 ClientDataSet.RecNo 作為在 ControlList 中單擊的行的索引嗎?或者有沒有辦法在 ButtonClick 中查看被選中的行?

uj5u.com熱心網友回復:
TControlList可以從 a 的ItemIndex屬性中讀取當前選擇的行。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/369766.html
