PDA

View Full Version : Help With Code - Please



dulux-oz
February 28th, 2014, 09:22
Can someone please explain why the following piece of code does NOT display the <empty> text when the field is empty ie on first creation?

Also, what am I getting wrong with the <gmvisibleonly /> tag - why is the Formated Text showing up on the Players' view (where Shared)?

Thanks.



<ft_record name="GM_Notes">
<anchored to="contentframe" position="over" />
<empty text="Test Text" />
<gmvisibleonly />
</ft_record>

Trenloe
February 28th, 2014, 10:29
The <empty> tag doesn't seem to be working in <formattedtextfield> controls. There are a few examples in the CoreRPG code and these don't populate. e.g. the "Notes" tab of an NPC should use the textres of "ft_empty" which is "Click to enter text" but nothing appears.

I don't know why the <gmvisibleonly /> isn't working - I've just done a quick test on the FT field in my formatted notes extension (https://www.fantasygrounds.com/forums/showthread.php?20555-Formatted-Player-Notes) and making the <basicft name="text"> control <gmvisibleonly /> hides it for the players but the GM can see it.

Is there any code somewhere setting your control visible?

dulux-oz
February 28th, 2014, 10:42
OK, that explains the <empty> tag - thanks Tren

Yes, the GM_Notes is called from a <tab_control> on "page 3" - I take it that that overrides the <gmvisibleonly />? If so, how would I go about reasserting the <gmvisibleonly /> - or not have that Tab appear for the Players - either works?

Thanks Tren

Trenloe
February 28th, 2014, 10:53
Yes, the GM_Notes is called from a <tab_control> on "page 3" - I take it that that overrides the <gmvisibleonly />? If so, how would I go about reasserting the <gmvisibleonly /> - or not have that Tab appear for the Players - either works?
The <gmvisibleonly /> shouldn't be overwritten by being enabled through the <tab_control> entry - but it might be due to some other code or an issue somewhere... Try adding the GM_Notes entry in a <windowclass> of it's own (in <sheetdata> within the window class) to see if that works OK.

Or, use the following code in the onInit() function of the control to set the control invisible if the user is not the GM:

<script>
function onInit()
if not User.isHost() then
GM_Notes.setVisible(false);
end
end
</script>

dulux-oz
February 28th, 2014, 10:55
Thanks Tren - I'll give in a go tomorrow - sleeptime now :)

Zeus
February 28th, 2014, 13:41
If I recall the empty <text> tag in ft has been buggy for a while. I had problems when developing the reference library classes for 5E at first I thought it might be a template override issue but as Trenloe states it crops up in several places where ft is used and not necessarily just from within templates. Meant to talk to JPG about it but forgot.