It is currently March 28th, 2024, 6:37 pm

Drop Down List for Region (Weather)

Get help with creating, editing & fixing problems with skins
Post Reply
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Drop Down List for Region (Weather)

Post by jminternelia »

Alright, I feel dense even asking this, however:

I am working on a weather suite and on my settings config, I have various input meters set up to find and enter location codes, API key, etc. The satellite weather I plan to use is segmented by region and requires downloading various frames. In order to not lock it to North Atlantic, I obviously have to have the user input their region. As such, I need to know how to make a dropdown list appear. I assume that I'd have to have the config read any possible selections from a varibles.inc and display the options there. When the user clicked the input field a drop down list would appear, they would click their region, and this would in turn write that key value to another key, which could then be read by the satellite config. The other prt I am unsure about is that the Satellite config would then need to read the value and select which to download based on that input.

Here is what I have so far, but not knowing how to go about this I haven't made an attempt to write any code for this specific function.
Attachments
X2ui Weather WIP_0.01.rmskin
(1.03 MiB) Downloaded 27 times
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Drop Down List for Region (Weather)

Post by eclectic-tech »

Here is one way to approach this. Create variables with the codes you expect, then write those to the included variables file, and refresh your weather skin group.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
Group=#RootConfig#
BackgroundMode=2
SolidColor=0,0,0,32

; ========= Metadata ==========
[Metadata]
Name=
Author=
Information=
License=Creative Commons Share-Alike NC 4
Version=

; ========= Variables ==========
[Variables]
Loc1=ABC
Loc2=DEF
Loc3=GHI
Loc4=JKL
Loc5=MNO


; ========= Measures ==========



; ========= Meter Styles ==========
[sList]
X=r
Y=1R
SolidColor=0,0,0,1
Group=Anagrams
Hidden=1
FontColor=255,255,255

; ========= Meters ==========

[Title]
Meter=String
Text=Locations
InlineSetting=Weight | 700
InlineSetting2=Case | Upper
InlineSetting3=Color | 255,255,255
InlineSetting4=Underline
SolidColor=0,0,0,1
LeftMouseUpAction=[!ToggleMeterGroup Anagrams]
Padding=2,4,2,1

[String1]
Meter=String
MeterStyle=sList
Text=#Loc1#
LeftMouseUpAction=[!WriteKeyValue Variables LocationAnagram #Loc1# "#@#variables.inc"][!RefreshGroup "#RootConfig#"]

[String2]
Meter=String
MeterStyle=sList
Text=#Loc2#
LeftMouseUpAction=[!WriteKeyValue Variables LocationAnagram #Loc2# "#@#variables.inc"][!RefreshGroup "#RootConfig#"]

[String3]
Meter=String
MeterStyle=sList
Text=#Loc3#
LeftMouseUpAction=[!WriteKeyValue Variables LocationAnagram #Loc3# "#@#variables.inc"][!RefreshGroup "#RootConfig#"]

[String4]
Meter=String
MeterStyle=sList
Text=#Loc4#
LeftMouseUpAction=[!WriteKeyValue Variables LocationAnagram #Loc4# "#@#variables.inc"][!RefreshGroup "#RootConfig#"]

[String5]
Meter=String
MeterStyle=sList
Text=#Loc5#
LeftMouseUpAction=[!WriteKeyValue Variables LocationAnagram #Loc5# "#@#variables.inc"][!RefreshGroup "#RootConfig#"]

loc5.gif
Aside:
In the setting skin, you are writing a new 'Location' variable instead of writing "LocationCode' for user input.
You are using deprecated bangs that should be updated. (!PluginBang and !RainmeterRefreshApp could be updated to !CommandMeasure and !RefreshApp)
I would avoid !RefreshApp as this will refresh ALL loaded skins. I set all my skins in skin group in the [Rainmeter] section, then use a group refresh; add Group=#RootConfig# to the [Rainmeter] section of all skins, then !RefreshGroup "#RootConfig#" to refresh only all your skins in the current root folder.
Your input commands could start at 1 for each unique UserInput measure; not incremented with each new measure.
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Drop Down List for Region (Weather)

Post by jminternelia »

Genius. Thanks!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Drop Down List for Region (Weather)

Post by eclectic-tech »

Glad to help. :thumbup:
Post Reply