Log in

View Full Version : WindowInstance createControl



Mephisto
October 6th, 2024, 20:34
Hi there,
I have an issue with the createControl command. I create a control with the following command.

_ctrlDiceTestField = window.createControl("dicefield_ability", sControlName, DB.getPath(nodeChar, "abilities." .. sStat .. ".score"))

DB.getPath(nodeChar, "abilities." .. sStat .. ".score") value is "charsheet.id-00001.abilities.athletics.score".

However, when I fetch the path of the control with "Debug.chat("Path self", _ctrlDiceTestField.getDatabaseNode())", it shows "charsheet.id-00001.skilllist.id-00072.charsheet.id-00001.abilities.athletics.score", i.e. it adds the window DB path to the path I hand over during creation.

I'm lost on how to assign the DB path "charsheet.id-00001.abilities.athletics.score" only to the field.

Moon Wizard
October 6th, 2024, 20:48
The source parameter expects the relative source path, not an absolute source path. If it's not relative, you won't be able to use the source parameter. It looks like in this case, you will not be able to use that.

Instead, you'll need to set up a DB handler on DB.getPath(nodeChar, "abilities.*.score") that triggers an update for whatever logic you had depending on that control.

Regards,
JPG

Mephisto
October 7th, 2024, 09:47
Thanks, that helps! Maybe the WIKI could be adjusted. It contains no hint about the relative/absolute path as far as I can see.