AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi Offene TDBLookupComboBox verursaxht Exception bei ESC-Taste
Thema durchsuchen
Ansicht
Themen-Optionen

Offene TDBLookupComboBox verursaxht Exception bei ESC-Taste

Offene Frage von "SneakL8"
Ein Thema von SneakL8 · begonnen am 1. Mai 2017 · letzter Beitrag vom 2. Mai 2017
Antwort Antwort
SneakL8

Registriert seit: 11. Feb 2016
24 Beiträge
 
#1

Offene TDBLookupComboBox verursaxht Exception bei ESC-Taste

  Alt 1. Mai 2017, 18:48
Hallo zusammen,

ich habe einen modalen Dialog mit "Abbrechen"-Button mit Cancel-Eigenschaft. Auf diesem Dialog befindet sich eine TDBLookupComboBox. Wenn ich diese zur Laufzeit aufklappe und dann die Esc-Taste drücke, erhalte ich eine EInvalidOperation-Exception "Ein deaktiviertes oder unsichtbares Fenster kann nicht den Fokus erhalten.".

Anbei der CallStack:
00511a19 +059 TG.exe Forms 4782 +4 TCustomForm.SetFocus
0050f94e +02e TG.exe Forms 3803 +3 TCustomForm.FocusControl
004f5850 +020 TG.exe Controls 7779 +3 TWinControl.SetFocus
00558663 +04f TG.exe DBCtrls 5146 +4 TDBLookupComboBox.CloseUp
0055967e +01e TG.exe DBCtrls 5509 +2 TDBLookupComboBox.WMKillFocus
004eeaa3 +1df TG.exe Controls 4645 +53 TControl.WndProc
004f27d2 +18e TG.exe Controls 6342 +33 TWinControl.WndProc
004f23a4 +034 TG.exe Controls 6237 +3 TWinControl.MainWndProc
0048bfe0 +014 TG.exe Classes 10966 +8 StdWndProc
775a8e54 +034 ntdll.dll KiUserCallbackDispatcher
0050fcc3 +03f TG.exe Forms 3891 +4 TCustomForm.SetWindowFocus
0050fd74 +080 TG.exe Forms 3906 +9 TCustomForm.SetActive
00510747 +02f TG.exe Forms 4168 +2 TCustomForm.WMActivate
004eeaa3 +1df TG.exe Controls 4645 +53 TControl.WndProc
004f27d2 +18e TG.exe Controls 6342 +33 TWinControl.WndProc
0050ddb8 +478 TG.exe Forms 3098 +103 TCustomForm.WndProc
004f23a4 +034 TG.exe Controls 6237 +3 TWinControl.MainWndProc
0048bfe0 +014 TG.exe Classes 10966 +8 StdWndProc
775a8e54 +034 ntdll.dll KiUserCallbackDispatcher
00511cef +283 TG.exe Forms 4843 +44 TCustomForm.ShowModal
005f7e78 +02c TG.exe UpdateForm 244 +4 TUpdForm.ShowModal
006605f7 +037 TG.exe TGStandard 711 +15 TTGStandardForm.ShowModal
00660248 +778 TG.exe TGStandard 662 +181 TTGStandardForm.CreateEx
0065fa7e +08a TG.exe TGStandard 460 +2 TTGStandardForm.Create
0066521b +04f TG.exe TGStandard 2201 +5 TTGStandardForm.CreateEditDlg
006653eb +05b TG.exe TGStandard 2236 +7 TTGStandardForm.DoKorr
0065d9f8 +020 TG.exe TGMain 2250 +3 TTGMainForm.KorrActionExecute
0048b085 +01d TG.exe Classes 10464 +3 TBasicAction.Execute
[...]

Nach einigen Tasts und Analyse sieht es für mich so aus als wenn die Esc-Taste durch den Cancel-Button zuerst das modale Formular schließt und danach die TDBLookupComboBox, ihre Auswahlliste und dabei den Focus an das modale Fenster zurückgeben will (Form.SetFocus), das aber gerade schon geschlossen wurde.

Ich hab schon geschaut, ob ich da irgendwetwas falsch mache, bin aber derzeit keine Schuld bewusst. Ist das evtl. ein Fehlverhalten der DBLookupComboBox? Tante Googlelieft mir dafür aber leider keine Anhaltspunkte.

Habt Ihr einen Tipp für mich?

Das passiert unter Delphi 7.01 (ich weiß, ist alt...).

Viele Grüße
Sneak-L8
  Mit Zitat antworten Zitat
Papaschlumpf73

Registriert seit: 3. Mär 2014
Ort: Berlin
312 Beiträge
 
Delphi 12 Athens
 
#2

AW: Offene TDBLookupComboBox verursaxht Exception bei ESC-Taste

  Alt 2. Mai 2017, 11:44
Das hatte ich auch schon mal, bin aber zu faul solchen Fehlern auf den Grund zu gehen. Das hier hilft jedenfalls:

Delphi-Quellcode:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if DBLookupComboBox1.ListVisible then
 begin
 DBLookupComboBox1.CloseUp(true);
 Abort;
 end;
end;
  Mit Zitat antworten Zitat
SneakL8

Registriert seit: 11. Feb 2016
24 Beiträge
 
#3

AW: Offene TDBLookupComboBox verursaxht Exception bei ESC-Taste

  Alt 2. Mai 2017, 21:30
Hallo Papaschlumpf73,

super, hab die FormClose-Methode meines zentralen Form-Vorfahrens erweitert und suche zunächst nach einer "offenen" DBLookupComboBox und schließe diese. Mache dann aber ein Action = caNone anstelle des Aborts, aber das ist vermutlich Geschmacksache.

Auf jeden Fall wird mit Esc nun nur noch die ComboBox geschlossen und erst beim zweiten Esc das Formular. Und vor allem ist die EInvalidOperation weg!

Vielen Dank!
Sneak-L8
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:29 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz