Hi,
If I close my app when the layout controls customization form is active, and I have an OnCustomization event handler assigned, it will cause an AV.
Open the attached app, hit the customize button, then close the main form.
It is crashing due to the code in OnCustomization:
procedure TForm7.dxLayoutControlCustomization(Sender: TObject);
begin
if dxLayoutControl.Customization then begin <— crash is here
// dlg opened…
dxLayoutControl.CustomizeFormTabbedView := true;
end
else begin
// dlg was closed, update stuff…
ReAlignChildCaptions(lgClient);
end;
end;
I can understand that things are being destroy so checking dxLayoutControl.Customization is attempting to create a window handle and hence the crash.
Is this a DX bug, or my bad code design?
I really need to know when the customization form has closed so I can re-wrangle my layout groups/items as I want. And that has to happen before the entire layout is streamed away. See my prior question: https://www.devexpress.com/Support/Center/Question/Details/T165479 This is the only place I could see to do this. Although I will probably need to subclass the customization form to do it better (eg my changes are applied in real-time, rather then waiting until the customization form is closed)
Yes, I realize I could check App.terminated and avert the AV but then I've missed my objective. IMHO the event handler should trigger, I do my custom code, and the app then proceeds to shutdown.
If DevExpress does not consider this to be a bug, is it documented somewhere that the developer should always check application.terminated in this event handler? One could also argue that this event handler should not be called at all if the application is terminating as the developer cannot do anything with the layout controls at that stage.
regards,
-randall
Shot - it just occurred to me that this will not compile for you… Open the DFM and replace "bw" with "cx" if you want to keep those grid around. Or just replace them with TPanels. And you can remove bwShared and bwSharedCX from the USES list and anything else that is "bw" specific.
sorry about that :(
-randall
Hello,
I have reproduced this problem. I am forwarding this issue to our developers for further processing.