-
November 6th, 2014, 04:16 #1
Calling WindowControls As Strings
Hi Guys,
Quick question: if I pass a variable (eg sPath="window.subwindow01.subwindow.number01") to a function (eg fpMyFunction(sPath,nValue)) what is the correct syntax for the following:
Code:function fpMyFunction(sPath,nValue) sPath.setValue(nValue); end
CheersDulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
November 6th, 2014, 10:55 #2
In your example, sPath is a variable that contains the complete control reference name, whereas you need the control object to be able to use API methods against the control. I'm not aware of a method that will allow you to get to the control object using the complete control reference name. To make this work, pass the control object reference to the function, not the control name then you can use .setValue directly against the object.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
November 6th, 2014, 11:02 #3
Dulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
-
November 6th, 2014, 11:14 #4
Yes, but you'd need to reference that within a script where the window variable is pointing to the correct window - within a script tied to a control this will be pointing to the window the control resides in, but if you are referencing this within a global script package it won't know what window is and you'll have to either pass/register the window variable in the global script package.
See "Script block scope" here: https://www.fantasygrounds.com/modguide/scripting.xcpPrivate Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
November 6th, 2014, 11:25 #5
Ok, thanks Tren, I think I've got it sorted now
Dulux-Oz
√(-1) 2^3 Σ Π
...And it was Delicious!
Alpha-Geek
ICT Professional
GMing Since 1982
NSW, Australia, UTC +10
LinkedIn Profile: www.linkedin.com/in/mjblack
Watch our games on Twitch: www.twitch.tv/dulux_oz
Support Me on Patreon: www.patreon.com/duluxoz
Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks