簡體   English   中英

Delphi10.1 Berlin .. 在打開 dblookupcombobox 菜單的情況下關閉表單時出現錯誤

[英]Delphi10.1 Berlin.. I get an error when I close the form with the dblookupcombobox menu open

當我關閉打開 dblookupcombobox 菜單的表單時出現錯誤。

錯誤消息: Cannot focus a disabled or invisible window

如果 dblookupcombobox 菜單未打開,則關閉表單時不會出現任何錯誤,當菜單仍然打開時關閉表單時會出現錯誤。

procedure TForm6.RzButton1Click(Sender: TObject);
begin
    with DataModule1.FDQuery6 do begin
        try
            SQL.Clear;
            SQL.Text:='insert into my_table (kayit_adi, fiyat, tarih, aciklama, list_id) values (:kayit_adi, :fiyat, :tarih, :aciklama, :list_id)';
            ParamByName('kayit_adi').Value :=DBLookupComboBox1.Text;
            ParamByName('fiyat').Value:=edit2.Text;
            ParamByName('tarih').AsDate:=RzDateTimePicker1.Date;
            ParamByName('tarih').AsDate:=RzDateTimePicker1.Date;
            ParamByName('aciklama').Value :=Edit3.Text;
            ParamByName('list_id').Value :=DBLookupComboBox1.KeyValue;
            ExecSQL;
        finally
            open ('Select * from my_table where convert(date,tarih) = convert(date, getdate());');
        end;

解決方法是使用 OnCloseQuery 事件關閉 DBLookupCombobox:

TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 
begin 
    DBLookupComboBox1.CloseUp(TRUE); 
end;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM