PDA

View Full Version : addTextWidget, and database for fields...



GrimmSpector
February 23rd, 2016, 16:49
modifying the corerpg set into a new ruleset, still learning.

Look at this piece of code:



<template name="string_labeled">
<stringfield>
<font>sheettext</font>
<lineoffset default="on">1</lineoffset>
<script>
labelwidget = nil;

function onInit()
if labelres then
labelwidget = addTextWidget("sheetlabelinline", string.upper(Interface.getString(labelres[1])));
else
labelwidget = addTextWidget("sheetlabelinline", string.upper(label[1]));
end
if labelwidget then
local w,h = labelwidget.getSize();
labelwidget.setPosition("bottomleft", w/2, h/2-4);
end
end
</script>
</stringfield>
</template>


Can't find any documentaton on addTextWidget, hoping someone can point me in the right direction.

In addition, this template is being used to implement strings, I just want to confirm that with the inheritance, when you implement this as a control, that the database node would be parent.name, where parent is the databasenode attached to the window class, and the name is the name property of the string_labeled element we're using. Excuse me if my terminology is imperfect.

Thanks!

Trenloe
February 23rd, 2016, 17:00
Can't find any documentaton on addTextWidget, hoping someone can point me in the right direction.
https://www.fantasygrounds.com/refdoc/widgetcontainer.xcp#addTextWidget


In addition, this template is being used to implement strings, I just want to confirm that with the inheritance, when you implement this as a control, that the database node would be parent.name, where parent is the databasenode attached to the window class, and the name is the name property of the string_labeled element we're using.
Assuming the string_labeled control is directly in the window instance (https://www.fantasygrounds.com/refdoc/windowinstance.xcp)(i.e. not in a subwindow or a windowlist) then yes.

GrimmSpector
February 23rd, 2016, 17:23
https://www.fantasygrounds.com/refdoc/widgetcontainer.xcp#addTextWidget


Assuming the string_labeled control is directly in the window instance (https://www.fantasygrounds.com/refdoc/windowinstance.xcp)(i.e. not in a subwindow or a windowlist) then yes.

Didn't think to look in widgetcontainer...thanks so much Trenloe, seems I'm on the right path!