View Full Version : Weather Set-up
Double_J
12-04-2006, 07:40 PM
I am using the weather driver and would like to customize the display. For instance, if I use the field day2stamp, it returns a text string of example: Tuesday Dec 6 and I would like to change that to just show the day Tuesday. Since I want to use this in the extended forcast, getting the current day would not really work, it has to be based off of the weather drivers returned text. In addition, I would like to take some of the other data that is returned and display it in a graphical icon. For instance the current wind direction, I would like to display a custom image to depict the direction. I am just doing the 30-day trial right now and am trying to figure out what exactly I can and can't do.
Dean Roddey
12-04-2006, 07:54 PM
You wouldn't be able to just show the day name. There is a translation function (the Xlat tab of the attributes for the dynmic text widget that you'd be using to display that info), but it assumes a fixed set of values for the field so that you can enter translation info. So you are kind of stuck on that one.
The wind direction you would need to do as a mapped image. Since there is no fixed set of values for that field, you cannot use an enumerated image. I theory there is probably a fixed set of values for it, but they are not indicated in the documentation so I just made that field a straight text field.
The mapped image will allow you to map values of the field to particular images. So you'd set up the map for N, S, W, E, NSW, etc..., and set the desired image for each variation. There could be a good number of variations, and I'm not sure at what level of detail the WC data stops, or what values they return in case of unknown and so forth. It's too bad they didn't better define the contents of this field in the protocol documentation.
Double_J
12-04-2006, 08:00 PM
Thank you Dean.
Does the XLAT feature accept a wild card? It would not be a big deal to take seven days (Ie: Tuesday Dec 6) and do a Tuesday* = Tuesday. The mapping feature should work out. Thanks again.
ok, here's the latest bad idea. Iteration on what I said earlier on the chat site.
Use a variables driver, setup 1 variable for each day you want to forecast.
Setup 7 different scheduled events, one to run on each night. On Monday 12:15am, set
Day1Word="Monday"
Day2Word="Tuesday"
Day3Word-"Wednesday".
On Tuesday at 12:15am, set
Day1Word="Tuesday"
Day2Word-"Wednesday"
Day3Word="Thursday"
Sure, it's ugly, but at least you *can* get there from here that way. Now it's just a matter of the easiest way to get there from here.
Dean Roddey
12-04-2006, 08:45 PM
Does the XLAT feature accept a wild card? It would not be a big deal to take seven days (Ie: Tuesday Dec 6) and do a Tuesday* = Tuesday.
No, it doesn't, but that's a good idea to consider for the next version.
zaccari
12-04-2006, 11:08 PM
I do something similar for my day and time in the bottom corner. I wanted the format to be Tuesday, Dec 5 03:07. The clock widget does half but I use an event to set the rest once a day.
Dean, if you're going to do wild cards, can we get regular expressions instead?
Russ...
--
LocalVars::SetVariable(LVar:sDOW, %(StdRTV:WeekDay))
LocalVars::SetVariable(LVar:sShortMonth, %(StdRTV:Month))
LocalVars::GetSubString(LVar:sShortMonth, 0, 3, LVar:sShortMonth)
LocalVars::Append(LVar:sDOW, , %(LVar:sShortMonth) %(StdRT...)
Devices::FieldWrite(Variable Driver.sDOW, %(LVar:sDOW))
Dean Roddey
12-04-2006, 11:52 PM
I could add another set of fields to the WC driver something like FCDayName1, FCDayName2, and so forth, where I pull out just the day name and store them. Then you could use those.
zaccari
12-05-2006, 06:17 AM
I could add another set of fields to the WC driver something like FCDayName1, FCDayName2, and so forth, where I pull out just the day name and store them. Then you could use those.I doubt I would be the only person here that would rather see you spend time adding the capability to modify text in dynamic text widgets. Involving multiple fields, using string operations like substr, append, etc would be much more useful in the long haul.
Russ...
Jonathan
12-05-2006, 06:55 AM
No, it doesn't, but that's a good idea to consider for the next version.
I would like to second the request that we be able to use the standard C++ Regex library (Regular Expression) Replace method in XLAT tab, this would easily allow advanced users the ability to have a very powerful mechanism for changing the displayed text :-)
And while I'm asking, may as well ask for that to be exposed in CML too :)
ToyMaster458
12-05-2006, 07:11 AM
Another Option is in the Template OnLoad do something like this
LocalVars::GetSubString($(Weather.Day1Stamp), 0, 3, LVar:X)
If System::Equals(LVar:X, Mon)
StaticText::SetText(Monday)
End
And So on
End
Another option would be for Dean to add a RightString, LeftString, and InString Function. Then it would work like
LocalVars::InString($(Weather.Day1Stamp), ' ', LVar:X)
LocalVars::LeftString($(Weather.Day1Stamp,LVar:Y)
StaticText::SetText(%(LVar:Y)
Double_J
12-05-2006, 10:54 AM
The image mapping worked fine. I will attempt the day change later after I clean up the user interface. Thanks everyone for the work-arounds.
Dean Roddey
12-05-2006, 10:56 AM
I guess the best solution, which would be generally useful and cover this one, is a current date widget that provides some options as to what you wat to display (among them a day offset from the current day.) Then you could just put one for today, one for today plus 1, etc... and set them up to just display the day name.
Double_J
12-05-2006, 11:04 AM
That would work, but I think allowing the XLAT to accept wild cards would work so much better. There are probably other instances where you want more descriptive text or less text. Either way at this point I am impressed with CQC.
vBulletin v3.5.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.