Constructor overridden by public properties...

  1. 10 months ago

    I'm trying to set a constructor method on my subclass PushButton and it got overridden by Public properties...
    I can't use Open event, i use it all around the app.

    The strange thing is :

    if i do
    the subclassPushbutton's constructor works fine
    but if i do
    w as a new windowXYZ(someparam)
    the subclasspushbutton's constructor got overriden by the public properties...

    how can i work around that ?

    PS : no open event ! it's already in use in sooooo many button

  2. When you place an instance of a control on a layout (a window) it gets a set of values (not so much properties as those are defined by the super)
    This way each instance can have its own values for the different properties - controls would be kind of useless if you could not have buttons with different captions etc

    Then, at runtime, when you show the layout (or construct one) the framework constructs the layout and then basically for each control executes code that is analogous to

              thisNewControl = new <Control of whatever type>

    so anything in the constructor that sets a property _may_ just get overwritten when the controls properties are set to the values from the layout

    This has been true forever (literally) - and isn't considered a bug FWIW

    The "workaround" is to use the open event

  3. but why "" vs "new mywindow" doesn't do the same order with the constructor ?

  4. Derk J

    17 Jul 2017 Pre-Release Testers, Xojo Pro

    New Mywindow must have implictinstance off in the ide. Not sure what your setup is though

  5. @Etienne P but why "" vs "new mywindow" doesn't do the same order with the constructor ?

    I'd have to see a sample that shows this
    There's no reason they should be any different

or Sign Up to reply!