PDA

View Full Version : Question regarding "bReadOnly"



Mephisto
September 5th, 2024, 17:22
Hi there,
I noticed that in "record_quest" we run this code

function update()
super.update();

local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
cr.setReadOnly(bReadOnly);
xp.setReadOnly(bReadOnly);
end
while in "record_skill" we run this more advanced code

function onInit()
self.update();
end
function update()
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode())
local tFields = { "stat", "text", };
WindowManager.callSafeControlsUpdate(self, tFields, bReadOnly);
end

Any particular reason why the same code isn't used?

superteddy57
September 5th, 2024, 17:44
For which ruleset? Off the top of my head from looking at the snippet, one is calling a deeper update function call while the other is just running the update at that particular level. You see this with merged controls.

Mephisto
September 5th, 2024, 18:12
The new 5E ruleset.

superteddy57
September 5th, 2024, 18:16
Then yes, it would mean super.update() is calling a layered update call. This runs that code instead of simply overwriting it with the current update call.