PDA

View Full Version : Setting the Window title by the ruleset



jreddin1
June 14th, 2015, 22:18
For those that are using 5E, you probably noticed that window titles moved from being vertical, and on the side to being horizontal and across the top. As part of my quest to figure out how to do things in FG, I dug around and, after way longer than it should have taken, I came up with the following lua function that you can call from the title control (i.e. setIconByRulset(self) :


function setIconByRuleset(wc)

if(wc.hasIcon() == false) then

Debug.console("setIcon - no icon", wc);
return;
end;

local rset = User.getRulesetName();
Debug.console("setIconbyRuleset rulsetName", rset);
if(rset == "5E") then

wc.setIcon("Icon_for_5E", true);
else

wc.setIcon("Icon_for_CoreRPG", true);
end
end;

Of course, to make this work, you need to have the following in your extension.xml/base.xml/etc.:


<icon file="graphics/someIcon5E.png" name="Icon_for_5E" />
<icon file="graphics/someIconCoreRPG.png" name="Icon_for_CoreRPG" />

Feedback is appreciated (even negative, condescending, hateful, or troll. I have thick skin).

damned
June 14th, 2015, 23:01
hey jreddin1 - why are you expecting trolling?
i havent looked at the code but certainly the second part of what you wrote is true.
the best way to start finding how all these things link together (once you find a starting point) is to use a Find In Files feature and search the whole ruleset for the string that you do know/have.

jreddin1
June 15th, 2015, 00:37
hey jreddin1 - why are you expecting trolling?
i havent looked at the code but certainly the second part of what you wrote is true.
the best way to start finding how all these things link together (once you find a starting point) is to use a Find In Files feature and search the whole ruleset for the string that you do know/have.

Lol! Not really expecting trolls, just making a joke :-)

File searching is definitely how I'm finding stuff. Unfortunately, there's some things going on that I haven't been able to trace yet. Great example: Story and Notes use the same frameset, close and resize controls, yet when you create a new window with the same features the close works, and resize doesn't! Found the close event handler, but so far no sign of the resize event handler. Lack of documentation makes even the simplest task difficult.