macMikey / LCB-missing-manual

I'm trying to learn LCB, again, but the docs are thin.
MIT License
4 stars 4 forks source link

[property metadata] default does what, exactly? #22

Closed macMikey closed 2 years ago

macMikey commented 2 years ago
property "test" get mTest set setTest
metadata test.default is "test"
metadata test.editor is "com.livecode.pi.string"
metadata test.label is "Test"

private variable mTest as String

handler setTest(in pTest as String) returns nothing
    put "test" into mTest
end handler

if I open the PI, the value is blank, even though a default is set. does the default value get set when the PI closes, if no value is assigned?

macMikey commented 2 years ago

if i assign a value in onLoad() or onCreate(), the value is displayed in this case does it depend on the editor?

macMikey commented 2 years ago

I see lots of default values, but when I look in the PI's, including the specific PI's for the properties, I am not finding the code for managing the defaults, yet, anyway.

macMikey commented 2 years ago

it seems like it's only for use with the right-click "Reset to default" option in the PI

BerndN commented 2 years ago

I tried your property and handler and it worked for me.???

handler setTest(in pTest as String) returns nothing put "test" into mTest end handler

that handler is used by the PI to change the variable mTest. The default value is set by the definition in the property metadata without handler setTest.

macMikey commented 2 years ago

i closed because it seems to be specific to the navrad widget, which is where i was testing (trying to find another problem in the widget) i took this code and threw it in a much smaller/shorter widget, and it worked as one would expect. so i think there's something going in in the navrad/navbar that is interfering, but doing it quietly. i have already discovered that there are other fails that are silent, like if you declare a String variable and then try to format as string, the same variable. it will fail, and stop execution of the handler, but not throw an error.