I get an error when I close the form having a dblookupcombobox menu opened.
Error message : Cannot focus a disabled or invisible window
If the dblookupcombobox menu is not open, I do not get any error when I close the form, I get an error when I close the form when the menu still open.
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;
The solution is to use the OnCloseQuery event to close the DBLookupCombobox:
TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
DBLookupComboBox1.CloseUp(TRUE);
end;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.