Welcome, Guest
Please Login or Register.    Lost Password?

Get Number of Calendars to show in text
(1 viewing) (1) Guest
Go to bottomPage: 123
TOPIC: Get Number of Calendars to show in text
#14839
Re:Get Number of Calendars to show in text 3 Years, 5 Months ago  
Thank you Jorge, that test skin helped. I can now see the text output from the script in the window I want it in.

I have two further questions. How do I modify the script to get it to just show the active calendars number.

IE: for 1 calendar I'd like it to show "1 Calendar"
IE2: for more than one active I'd like it to show plural on the "Calendar"

so ... for 3 active, the output would be "3 Calendars"

Last question: when the window redraws, it moves from it's current location on my screen. IS it possible to have the window draw in exactly the same place it was already?

Again, thank you so much for your help
Rodger
Junior Boarder
Posts: 33
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Manyk Photography Location: Canada Birthday: 05/07
The administrator has disabled public write access.
 
#14840
Re:Get Number of Calendars to show in text 3 Years, 5 Months ago  
I messed around with the script a tiny bit and changed the following:

Rainlendar_SetItemValue(window, "MyWindowName.Text", "text", active .. " of " .. value)

to:

Rainlendar_SetItemValue(window, "MyWindowName.Text", "text", active .. " Calendars " )

So now it shows the number and the text like "5 Calendars"

Was this the right thing to do? I removed what I THINK is a field or item value from the SetItemValue, and I'm not sure if removing that might make Rainlendar unstable.

Although this does not solve the singular/multiple (plural) display of "Calendars" ... it works when I enable or disable calendars at will.
Rodger
Junior Boarder
Posts: 33
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Manyk Photography Location: Canada Birthday: 05/07
The administrator has disabled public write access.
 
#14842
Re:Get Number of Calendars to show in text 3 Years, 5 Months ago  
Thank you Jorge, that test skin helped. I can now see the text output from the script in the window I want it in. Its good to know.

IE: for 1 calendar I'd like it to show "1 Calendar"
IE2: for more than one active I'd like it to show plural on the "Calendar"

Rainlendar_SetItemValue(window, "MyWindowName.Text", "text", active .. " of " .. value)
Rainlendar_SetItemValue(window, "MyWindowName.Text", "text", active .. " Calendars " )
So now it shows the number and the text like "5 Calendars"
Was this the right thing to do? I removed what I THINK is a field or item value from the SetItemValue, and I'm not sure if removing that might make Rainlendar unstable.
Although this does not solve the singular/multiple (plural) display of "Calendars" ... it works when I enable or disable calendars at will.
Don't worry. That's correct, it was just an example. But don't remove the line value = tonumber(Rainlendar_GetOption("Calendars", "Count")) because you need that value to know how many calendars you have. (maybe the name doesn't say anything. A name like amount or total or totalCalendars will be better).

To show singular/plural form of Calendar you need a little more. Instead of directly set " Calendars" do the following:
Code:

newText = " Calendar"
if active > 1 then newText = newText .. "s" end
Rainlendar_SetItemValue(window, "MyWindowName.Text", "text", active .. newText)


If active is 0 or 1 it will show " Calendar", if it's more than 1, will add the "s" at the end.
There's another way to do this, avoiding the singular/plural forms. You can directly show "Calendar(s)" and don't worrying if it is 0, 1 or more.

Last question: when the window redraws, it moves from it's current location on my screen. IS it possible to have the window draw in exactly the same place it was already? This is probably caused by the window's size. Try reducing the width and height of the window.
To show the rectangles of each element, open the file Rainlendar2.ini in the user folder and add AddSkinRectangles=1 below the first line (which would be [DefaultSettings]). To not show the rectangles change 1 to 0.
Jorge_Luis
Platinum Boarder
Posts: 795
graphgraph
User Offline Click here to see the profile of this user
Gender: Male My Rainlendar Skins Location: Argentina Birthday: 03/15
Last Edit: 2011/03/24 11:04 By Jorge_Luis.
The administrator has disabled public write access.
 
#14843
Re:Get Number of Calendars to show in text 3 Years, 5 Months ago  
OK, THANK YOU again Jorge. The script is working exactly the way I want now. I did add one minor modification above the if active < 1 line:

if active < 1 then newText = newText .. "s" end

This way, if no calendars are selected it shows "0 Calendars" ... it's a bit more grammatically correct

Now onto the window moving on refresh:
I added AddSkinRectangles=1 to the ini and it does indeed show the rectangles.
In my skin I noticed I had not added a height value to the window ... SO, I added it.

Now my window has the values:
<window id="MyCalendar" w="243" h="335" threshold="100" default="0" oncreate="MyCalendar_Initialize('#SKIN#', '#ID#')"

The entire window still refreshes at the middle of my screen, maybe 200 pixels down even though I copied the height and width values of the rectangles exactly.

I am wondering IF this has to do with the fact that my "EventList" is attached to the main window "MyCalendar" ... because the Eventlist would be dynamic right?
Rodger
Junior Boarder
Posts: 33
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Manyk Photography Location: Canada Birthday: 05/07
The administrator has disabled public write access.
 
#14844
Re:Get Number of Calendars to show in text 3 Years, 5 Months ago  
I knew you would said that. In fact, the more correct way to show the "s" is: if active ~= 1 then (literally: "if active is not 1 then..." c'mon, how many times you will have 0 calendars showed? )

If the event list is in the same window, that would be no problem, because if you have more events than the window height a scrollbar should appears on the right side. (did you have the scrollgroup item surrounding the event list item?)

One way to check the size is to hide all windows except this one, and drag over the desktop until it snap to the borders, then you will know how big is the window (the "visible window" could be smaller than the window itself). Or set a very small value to the window, and then increase until you see all the items.
Jorge_Luis
Platinum Boarder
Posts: 795
graphgraph
User Offline Click here to see the profile of this user
Gender: Male My Rainlendar Skins Location: Argentina Birthday: 03/15
The administrator has disabled public write access.
 
#14845
Re:Get Number of Calendars to show in text 3 Years, 5 Months ago  
Oddly enough, when designing my skin(s), I disable all calendars to refresh faster ... as my calendars are Google and take a second or two to refresh.

Another script question. How would I add the text "All" instead of the total number of calendars IF all calendars are selected.

So, if all 7 of my calendars are active, the text would be "All Calendars" instead of "7 Calendars"

I've been farting around with the script, but... just breaking it.

With regard to the window refresh position: SO far I only have the one window for my skin, and it snaps exactly as it should on the desktop, so I know the sizing is correct.

I do not have a scrollgroup for my events, because I want the window to resize to show all of the events that are upcoming for the next 7 days.
Rodger
Junior Boarder
Posts: 33
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Manyk Photography Location: Canada Birthday: 05/07
The administrator has disabled public write access.
 
Go to topPage: 123
get the latest posts directly to your desktop