Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1035

Bugs & Feature Suggestions • Re: [BUG?] Initial value of a String measure

$
0
0
It might not seem obvious, but this is expected behavior during initialization process, especially when self-referencing a section variable.

Prior to intializing each measure/meter, a measure options need to be read and processed before a meter is initialized. This ensures a meter properly utilizes the Substitute option correctly (more on this later). Once the measures options are read, each meter reads its options and also initializes. Then all the measures initialize.
https://github.com/rainmeter/rainmeter/blob/master/Library/Skin.cpp#L2740-L2762

It is also important to remember that when using a section variable in an option, the parser first tries to use the string value of the referenced measure. If no string value is available, the number value is used. The value (string or number) is then passed through the Substitute process before finally being replaced.

So, let's break this down a bit:
  • Read options from measures (just prior to the initialization process)
    • Read [Calc] options. While the Formula option is read, the measures number value remains 0 (because no Update has happened yet).
    • Read [Enum] options. While the String option is read, it self-references itself and concatenates the number value from the Calc measure (along with a comma), it ends up being: 0 , (first box is an empty string) or 0,. This ends up being the string value of the measure at this point because the string is processed during the section variable replacement process, not during the Update cycle.
  • Initialize meters
  • Initialize measures
    • Intialize [Calc]. Its number value remains 0. There is no string value.
    • Intialize [Enum]. Its number value is 0. The string value evaluates to: 0,
  • First Update
    • Update measures
      • Update [Calc]. Its number value is 3. There is no string value.
      • Update [Enum]. Its number value is 0. At this point, the string value evaluates to: 0, 3 , or 0,3,
    • Update meters
    • Redraw
  • Second Update
    • Update measures
      • Update [Calc]. Its number value is 3. There is no string value.
      • Update [Enum]. Its number value is 0. At this point, the string value evaluates to: 0,3, 3 , or 0,3,3,
    • Update meters
    • Redraw
  • ...
Hopefully that makes a little sense.

-Brian

Statistics: Posted by Brian — Today, 7:07 am



Viewing all articles
Browse latest Browse all 1035

Trending Articles