OnPropertyChanged ?

0 favourites
  • 10 posts
  • I paste a part of a post I wrote few days ago.

    I encountered that I guess is a bug...

    In edittime.js, in OnPropertyChanged, I compare two properties that makes a change in another property...

    if (this.properties["Screen"] == "Low" && this.properties["Orientation"] == "Vertical")

              {

                   this.properties["Screen width"] = 320;

                   this.properties["Screen height"] = 480;

              }

    But, in C2, when I set the property "Screen" to "Low", it doesn't automatically change the "Screen width" value to "320", as it has to do.

    I have to input something in the "Screen width" input area, and after that, the value updates automatically to "320"....

  • Hmm... does it work if you add RefreshPropertyGrid() after setting the other two properties?

  • Ashley

    It works but popped up me a CheckFailure dialog.

    'Refreshing properties bar when in a property changed handler. This is unstable.

    Condition: !in_propchanged_handler

    File: Bars\PropertiesBar.cpp

    Line: 820

    Function: void_cdecl CPropertiesBar::Refresh(void)

    ...'

  • I tried to add RefreshPropertyGrid(); in Draw and it works perfectly...

  • Hmm, you really shouldn't refresh the property grid in Draw, it'll slow down the whole editor... I'll try and fix calling RefreshPropertyGrid from the OnPropertyChanged handler.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I guessed it. Thanks ashley.

  • First of all, thanks Ashley for fixed this.

    I was wondering how to test only one property changed.

    I mean, for the moment, when I put a condition in OnPropertyChanged, it's fired my event each time a property is changed.

    I would like that it fires only when one specific property is changed.

    Am I clear ?

  • Might I ask again please?

  • septeven I'm not sure what you mean - OnPropertyChanged is fired once only when a specific property is changed, you filter out the ones you want by comparing the name of the property that was changed.

  • Sorry, I looked for a solution again in other plugins and find the condition with property_name.

    Thanks Ashley

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)