|
Re:Month and Year %visible% 2 Years, 2 Months ago
|
|
The showmonth should work in the time element too:
| Code: |
<time x="50" y="0" element="font.normal" align="CENTER" format="%B - %Y" showmonth="%Visible_month%" />
|
|
|
Rainy
Moderator
Posts: 5359
|
|
|
|
|
Re:Month and Year %visible% 2 Years, 2 Months ago
|
|
|
Thank You Everyone.
anoob - that code worked perfectly.
Rainy - I swear I tried that and did not work for me. I suppose I forgot a closing or SOMETHING when I first tried it. This time I copied your code exactly as posted and I removed all references to the script as well as the script in the folder just to make SURE Rainlendar was loading it without the lua ... but, it DOES WORK!
|
|
|
|
|
|
|
Re:Month and Year %visible% 2 Years, 2 Months ago
|
|
anoob wrote:
I had run Jorge's code, and find some doubt:
a) Rainlendar_SetEventHandler() can only transfer two parameters, so "function SkinFormatTime_ChangeDate(params, window, userData)" is wrong, it's not working.
b) The lua file is not working when it's first time to draw window.
About the a) item, I based all my scripts on Rainy's previous scripts. I found in photos.lua this two EventHandlers:
| Code: |
-- Set handlers for mouse enter and leave events
Rainlendar_SetEventHandler(Shadow4_Photos_OnMouseEnter, 7, window)
Rainlendar_SetEventHandler(Shadow4_Photos_OnMouseLeave, 8, window)
|
and the functions are:
| Code: |
function Shadow4_Photos_OnMouseEnter(eventData, window, userData)
function Shadow4_Photos_OnMouseLeave(eventData, window, userData)
|
What's (or where's) the difference?
On b), when did not work? Really, because it worked for me when I added it, when I refreshed, when i restarted..., but another guy has the same problem with another skin of me and I would like to find a way to solve this.
Another thing: In the way I send the window's name to the function and without splitting it worked for me. Is this a bug? It's the same?
Although the showmonth is the better answer, I'm trying to improve my Lua and Rainlendar knowledge, because in the last weeks my answers seem too odd. I had previously a confusion with the translation of "Settings..." and "Options..." because the two are translated as "Opciones" in Spanish.
|
|
|
|
|
|
|
Re:Month and Year %visible% 2 Years, 2 Months ago
|
|
|
Jorge:
About the a) item:
i am reference help file, it wrote:
"The callback is a normal lua function which gets an event data and the userdata as parameters [function NameOfTheCallback(eventData, userData)].",
so i thought that SetEventHanlder() can only transfer two parameters, but i know i am wrong after saw the photos.lua you say, your way can work also.
Then, i checked the parameters you used, i found
params = eventData <-- it's a table
window = "#SKIN#::#WINDOW#" <-- it's equal "userData" i used
userData = "" <-- it's always empty
so, (params, window, userData) is equal (_, userData).
About the b) item:
it no worked for me when I added it, refreshed, restarted;
i must click a button or press arrow key,
so i add Rainlendar_Redraw(1, window) to make worked.
|
|
|
|
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

|
|
|
Re:Month and Year %visible% 2 Years, 2 Months ago
|
|
Thanks anoob.
I will try the Redraw thing the next time.
about the first, userData is always empty because no value is passed.
After reading your code, I tried this (forget the names, they're just mixed  ):
| Code: |
function SkinFormatTime_Initialize(skin, window)
Rainlendar_SetEventHandler(SkinFormatTime_ChangeDate, 4, window, "test")
end
function SkinFormatTime_ChangeDate(params, window, userData)
if params then Rainlendar_Log("params: " .. params.button) end
if window then Rainlendar_Log("window: " .. window) end
if userData then Rainlendar_Log("userData: " .. userData) end
end
|
The output is:
16:00:11: [1:20:53.156] params: 3
16:00:11: [1:20:53.156] window: Counter Clock::SkinFormatTime
16:00:11: [1:20:53.156] userData: test
So, I think there is a third hidden argument. Maybe its just something missing in the help file. 
|
|
|
|
|
|
|
Re:Month and Year %visible% 2 Years, 2 Months ago
|
|
|
I think so.
So, I think the whole syntax should be like this:
Rainlendar_SetEventHandler(callback, event, window, moreData)
function callback(eventData, windowData, moreData)
|
|
|
|
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

|
|
|