Welcome, Guest
Please Login or Register.    Lost Password?

Selecting images based on option selection
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Selecting images based on option selection
#17044
Selecting images based on option selection 1 Year, 12 Months ago  
Hello again.

Here's my problem...

I'm creating with a calendar skin, and I have it working pretty well, now I have an esthetic problem. When I select to show week numbers in my calendar (from the options menu) my day number have to shift to the right slightly to make room for them. This in itself is not a problem. But then my today marker does not center properly over the today date. So I created another image for the today marker that is a little smaller, and that works fine, as long as I have week numbers displayed. When I turn off week numbers again I have a problem of the today marker being off center.

This would be easy to remedy if LUA allowed IF..THEN..ELSE statements, but of course it does not. And I just can't think of a way to make an image selection based on a menu option. My basic thinking is something like

IF appearance visible="%Show_week_numbers%" THEN element="bitmap.marker-narrow" ELSE element="bitmap.marker"

Any idea how I can get this type of results?

Thanks in advance...

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.
 
#17046
Re:Selecting images based on option selection 1 Year, 12 Months ago  
This would be easy to remedy if LUA allowed IF..THEN..ELSE statements, but of course it does not.
. . . . .
My basic thinking is something like IF appearance visible="%Show_week_numbers%" THEN element="bitmap.marker-narrow" ELSE element="bitmap.marker" Any idea how I can get this type of results?

First, the today-marker can automatically align the center of the date if you have setting the 'date' and 'today-marker' both are align="CENTER".

Second, your idea is right. Lua can use "if .. then .. (else ..) end" statement. You can use Rainlendar_GetVariable(SKIN, WINDOW, VariableName) to get the values of variable, and use Rainlendar_SetItemValue(WINDOW, ITEM, FIELD, VALUE) to set a new value for the item's field, like :
Code:

 IsShowWeekNumber = Rainlendar_GetVariable("Shadow4", "Calendar", "Show_Week_nubmers")
if IsShowWeekNumber == 1 then
   Rainlendar_SetItemValue("Calendar", "today_ID", "element", "bitmap.marker-narrow")
  else
   Rainlendar_SetItemValue("Calendar", "today_ID", "element", "bitmap.marker")
end
Rainlendar_Redraw(0, "Calendar")

anoob
Platinum Boarder
Posts: 476
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
 
#17047
Re:Selecting images based on option selection 1 Year, 12 Months ago  
So if I understand you correctly, LUA does handle if.. then.. else.. statements. Good to know. I see how your code works and it looks simple enough. But I imagine I would have to incorporate the code into a script, not an xml file, right? (I've just never seen code like that used in xml files, but heh, I'm just a nooby here.

Thanks for the input, I'll check it out.
Mirage
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop