KeyWorksRW / wxUiEditor

RAD tool used to create and maintain wxWidgets UI elements.
Apache License 2.0
62 stars 5 forks source link

Bug: Didn't manage to import a number of elements from a .wxs file #1478

Open kencamargo opened 2 weeks ago

kencamargo commented 2 weeks ago

Description:

When importing a wxs layout file, I got the following errors:

Unable to create wxBitmapButton as a child of wxNotebook Unable to create wxButton as a child of wxNotebook Unable to create wxButton as a child of wxPanel Unable to create wxGrid as a child of wxNotebook Unable to create wxStaticText as a child of wxNotebook Unable to create wxTextCtrl as a child of wxNotebook

Those work without problems in wxSmith, though. Couldn't attach the file, copying it below:

<?xml version="1.0" encoding="utf-8" ?>

Assistente 523,349 0 1 3 523,23 16,8 14 bold 0 swiss Sans wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL 523,276 202,14 523,260 40,72 400,27 448,72 40,144 400,27 448,144 48,48 48,120 174,11 6 1 20 40 65 Campo Bloco Comp. Corr. Inc. Lim. 16,24 448,168 104,208 224,208 344,208 480,40 1 480,80 160,15 60,140 80,72 64,17 60,24 80,104 180,72 180,104 0 170,135 175,19 40,32 350,176 416,176 36,36 0 Aceita 464,176 36,36 Abandona 40,8 wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL 523,47 340,8 425,8 wxBOTTOM|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL 5 Seleciona arquivo Seleciona arquivo
KeyWorksRW commented 1 week ago

I see what the problem is. Without a top level sizer for a wxNotebook or wxPanel, wxWidgets won't be able to automatically size/resize child controls based on their size and possible scale factor (currently that only affects Windows, but will presumably affect Linux at some point). By default, wxUiEditor insists on a sizer as a parent for the controls you are trying to add. While that's generally a good idea, wxWidgets does not require it and it certainly should not be required when importing. I can certainly change that for importing, and perhaps relax the sizer requirement for books and panels.

kencamargo commented 1 week ago

Thanks a lot!