rpotor
October 27th, 2019, 13:37
I know there will be a totally simple way to do this and I'll feel dumb, but anyways:
In a windowclass I have a stringcontrol definition like so:
<stringcontrol name="theology">
<anchored to="knowledgesframe" position="insidetopleft" offset="10,240" />
<center />
<font>sheettextsmall</font>
<static>Theology</static>
</stringcontrol>
Within the same windowclass I have a number defined like so:
<basicnumber name="theologyscore">
<anchored to="knowledgesframe" position="insidetopright" offset="50,240" width="28" height="16" />
<script>
function onDoubleClick(x,y)
local abscorevalue = getValue();
local abname = window.theology.getValue();
end
</script>
</basicnumber>
And this works as is, without problem, but bear with me, we're slowly getting to my question. :-)
So, with the control named theologyscore I can also do this if I want to:
local controlname = "theologyscore";
local abscorevalue = window.getDatabaseNode().getChild(controlname).get Value();
This works because the theologyscore control is in the database. However what I would like to accomplish is that on this line in the code:
local abname = window.theology.getValue();
I would like to reference the stringcontrol named theology with a variable, like I can do it with the theologyscore control in the getChild function in my above example. The problem of course is, that a stringcontrol is not in the database, so I can't do a getDatabaseNode().getChild call on it. So what I would like to do is something like:
local controlname = "theology"
local abname = window.GetControlValueByName(controlname)
Of course I know a GetControlValueByName function does not exist in Fantasy Grounds, well at least as far as I know :-), so it's just to demonstrate what I would like to accomplish.
Is there any way to do something like this?
In a windowclass I have a stringcontrol definition like so:
<stringcontrol name="theology">
<anchored to="knowledgesframe" position="insidetopleft" offset="10,240" />
<center />
<font>sheettextsmall</font>
<static>Theology</static>
</stringcontrol>
Within the same windowclass I have a number defined like so:
<basicnumber name="theologyscore">
<anchored to="knowledgesframe" position="insidetopright" offset="50,240" width="28" height="16" />
<script>
function onDoubleClick(x,y)
local abscorevalue = getValue();
local abname = window.theology.getValue();
end
</script>
</basicnumber>
And this works as is, without problem, but bear with me, we're slowly getting to my question. :-)
So, with the control named theologyscore I can also do this if I want to:
local controlname = "theologyscore";
local abscorevalue = window.getDatabaseNode().getChild(controlname).get Value();
This works because the theologyscore control is in the database. However what I would like to accomplish is that on this line in the code:
local abname = window.theology.getValue();
I would like to reference the stringcontrol named theology with a variable, like I can do it with the theologyscore control in the getChild function in my above example. The problem of course is, that a stringcontrol is not in the database, so I can't do a getDatabaseNode().getChild call on it. So what I would like to do is something like:
local controlname = "theology"
local abname = window.GetControlValueByName(controlname)
Of course I know a GetControlValueByName function does not exist in Fantasy Grounds, well at least as far as I know :-), so it's just to demonstrate what I would like to accomplish.
Is there any way to do something like this?