Page MenuHomeFeedback Tracker

createDialog doesn't play nice with subclass inheritance
New, WishlistPublic

Description

When you inherit from a dialog class and then inherit from the "controls" subclass of the parent dialog, any control classes inherited won't show up when createDialog is used.

They will correctly show up in the config viewer however.

Details

Legacy ID
4172320593
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Create a new addon and add the example below to config.cpp.

Example_Dialog1 contains a working dialog with a listbox and two buttons. In Example_Dialog2 I expect the dialog to be the exact same, except the background box is white instead of black. However when tested using createDialog you can see this is not the result.

Also worth checking the config viewer to see that the inherited control subclasses are listed correctly.

*Example Below*

class RscButtonMenuCancel;
class RscButtonMenuOK;
class RscListbox;
class RscText;

class Example_RscBaseDialog
{

idd = -1;
movingEnable = true;
onLoad = "\
    [] spawn {\
        while {dialog} do {\
            if !(alive player) then {\
                closeDialog 0;\
            };\
        };\
    };\
";

};

class Example_Dialog1: Example_RscBaseDialog
{

class controls
{
    class BackgroundBox: RscText
    {
        x = safezoneX+safezoneW*0.4;
        y = safezoneY+safezoneH*0.325;
        w = 0.2*safezoneW;
        h = 0.165*safezoneH;
        colorBackground[] = {0,0,0,0.7};
    };
    class Listbox: RscListbox
    {
        idc = 101;
        x = safezoneX+safezoneW*0.405;
        y = safezoneY+safezoneH*0.33;
        w = 0.19*safezoneW;
        h = 0.155*safezoneH;
        colorBackground[] = {0,0,0,0.5};
    };
    class ButtonCancel: RscButtonMenuCancel
    {
        action = "closeDialog 0;";
        x = safezoneX+safezoneW*0.44;
        y = safezoneY+safezoneH*0.495;
        w = 0.05*safezoneW;
        h = 0.025*safezoneH;
    };
    class ButtonOK: RscButtonMenuOK
    {
        x = safezoneX+safezoneW*0.51;
        y = safezoneY+safezoneH*0.495;
        w = 0.05*safezoneW;
        h = 0.025*safezoneH;
    };
};

};

class Example_Dialog2: Example_Dialog1
{

class controls: controls
{
    class BackgroundBox: BackgroundBox
    {
        colorBackground[] = {1,1,1,0.7};
    };
};

};

Additional Information

Event Timeline

SilentSpike edited Additional Information. (Show Details)
SilentSpike set Category to Scripting.
SilentSpike set Reproducibility to Always.
SilentSpike set Severity to None.
SilentSpike set Resolution to Open.
SilentSpike set Legacy ID to 4172320593.May 7 2016, 7:53 PM

Reproduced :(
Also, still present in 1.36 :(