Welcome, Guest
Please Login or Register.    Lost Password?

Global vs Window variables...
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Global vs Window variables...
#16984
Global vs Window variables... 2 Years, 5 Months ago  
I apologize if this thread is in the wrong place, I'm just not sure where it really goes. Feel free to move it if need be.

Anyway, I'm wondering when I create some variables they automatically become Global variables and others remain Window variables?

Is there a way I can set the variable type myself rather than letting the program do it?

Thanks for any and all help.
Mirage
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#16991
Re: Global vs Window variables... 2 Years, 5 Months ago  
The variable type depends on if you define the window for it or not. If the variable is set to a specific window it is shown only for it. If the window is not defined the variable will be global.
Rainy
Moderator
Posts: 5963
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#16998
Re:Global vs Window variables... 2 Years, 5 Months ago  
Ah, that makes sense now that I look at it more closely. Now my problem is, when I change the code below, by simply adding the "window=" to the Skin.xml file as shown below:



Skin.xml
<variable name="Digital_Clock_fontsize" default="60" window="Digital Clock" description="Set the font size of the Digital Clock." />

Elements.xml
<font id="font.clock" facename="Ariel" size="%Digital_Clock_fontsize%" />

Digital Clock.xml
<time x1="10" y2="10" align="TOP-LEFT" element="font.clock" color="%Digital_Clock_color%" effect="BORDER" format="%Format%" timezone="%Timezone%" DST="1"/>

The font size does not change, and I now get an error that says "ERROR: Illegal use of binary operator at pos 0 in expression "%Digital_Clock_fontsize"

I'm not really sure what I'm doing wrong. Could somebody please explain?

Thanks much

Glenn
Mirage
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#17000
Re:Global vs Window variables... 2 Years, 5 Months ago  
Do you see ?
Variable %Digital_Clock_fontsize% is used in elements.xml, rather than used in Digital_Clock.xml, so you don't need specify the window="", just like this:

skin.xml
<variable name="Digital_Clock_fontsize" default="60" description="Set the font size of the Digital Clock." />
anoob
Platinum Boarder
Posts: 500
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
#17001
Re:Global vs Window variables... 2 Years, 5 Months ago  
Right, I understand that part. But leaving the window= off will make it a global variable which is what I'm trying to avoid. So following that logic, I should be able to change Digital Clock.xml to look like this:

Digital Clock.xml
<time x1="10" y2="10" align="TOP-LEFT" facename="Ariel" Size="%Digital_Clock_fontsize" color="%Digital_Clock_color%" effect="BORDER" format="%Format%" timezone="%Timezone%" DST="1"/>

correct? Let me give that a shot and see what happens.

But your input and comment anoob, are always welcome. This is all just a learning experience for me. And a lot of fun.

Thanks
Mirage
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#17002
Re:Global vs Window variables... 2 Years, 5 Months ago  
Right now, if you wish to change font size, you must set a global variable to do it.

Note: is "%Digital_Clock_fontsize%", not "%Digital_Clock_fontsize" (lost '%')
anoob
Platinum Boarder
Posts: 500
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
Last Edit: 2012/04/15 13:21 By anoob.
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
Go to topPage: 12
get the latest posts directly to your desktop