Mein Programm stürzt ab, bei Doppelklick auf Symbol
-
Hi!
I created a Symbol class derived from TObject and a container
TSymbolContainer, where all Symbols are located. The user can move and
select Symbols like in Visio.My program craches undeterministically whenever i double click on the symbol
for a few times. The debugger points in "Controls" to:... if GetCapture = Handle then begin Control := nil; if (CaptureControl <> nil) and (CaptureControl.Parent = Self) then // THIS LINE Control := CaptureControl; end else ...
In my Container I catch an event, if the user double clicks on my symbol:
TSymbolContainer::SymbolMouseDown(... { // Catch double click on Symbol if(Button == mbLeft) { if(Shift.Contains(ssDouble)) { SymbolDblClick(); return; } } .... ... }
The Container overgives the event to the main form:
void __fastcall TFlowContainer::SymbolDblClick() { if(OnSymbolDblClick) OnSymbolDblClick(this); }
In my main form I react on this event of the container:
//-------------------------------------------------------------------------- - void __fastcall TFormMain::FlowContainerSymbolDblClick(TObject *Sender) { // Here I delete the complete graph of symbols including the one, the user double clicked on ... }
Why does my program chrash? I have an Idea: I react on the double click by
deleting the symbol, maybe the symbol is needed to end the symbolmousedown
event?Any ideas how to fix this?
Thanks
GunterEdit:
Bitte die Code-Tags benutzen. Danke!
-
Also bitte! Wenn schon, dann Deutsch.
MfG
xy
-
Gunmuc schrieb:
The Container overgives the event [...]
Ich glaub, ich muss mich auch gleich overgiven.
Bitte bleib beim Deutsch, das hätte zusätzlich auch den Vorteil, dass du ggf. besser erklären könntest, was du eigentlich machen willst und wo das Problem liegt.
-
Gunmuc schrieb:
if(Shift.Contains(ssDouble)) { SymbolDblClick();
Hi Gunmuc,
I think, you should not call SymbolDblClick() in SymbolMouseDown().
Use the Eventhandler SymbolDblClick() directly.PS: Und in Deutsch gibt's bestimmt mehr Hilfe hier.