It is currently November 29th, 2020, 7:41 pm

!GoTo bang??

Share and get help with Plugins and Addons
User avatar
Mic Dundee
Posts: 4
Joined: March 3rd, 2014, 11:18 am

!GoTo bang??

Post by Mic Dundee »

Been searching the forums (and Manual) but can't find anything on this topic.

Here's the setup:

Have two InputText measures in a SlideShow skin. Width x Height

Currently, they both can be edited (I have Command2=[!UpdateMeasure SetWIDTH(or SetHEIGHT)] before the skin is Refreshed -- which(Refreshing) is done by clicking a 'Update' meter checkbox next to the sizes.

What I'd like to do is edit the 'Width' Input, hit enter(or tab) and have Command2 on this SetWIDTH measure =[!UpdateMeasure SetWIDTH][!GoTo SetHEIGHT]. Automatically putting the focus on the SetHEIGHT Input box. After editing (or not) this size, hitting enter would then Refresh the skin (SetHEIGHT measure Command2=[!Refresh]), thereby eliminating the need to click the SetHEIGHT Input or the current Refresh checkbox.

I have SetHEIGHT configured as described above; what I'm trying to accomplish is after selecting the SetWIDTH Input with the mouse I could input everything from the keyboard without having to click the SetHEIGHT Input with the mouse and then having to click the Refresh checkbox.

Is there any thing (i.e., !GoTo bang) that navigates the user to the next/another input field? Or are there alternatives that I'm not considering/missing??
User avatar
jsmorley
Developer
Posts: 21552
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: !GoTo bang??

Post by jsmorley »

There really is no way to get exactly the functionality you want, InputText just doesn't work that way.

You can't use TAB to switch between input fields. First, InputText doesn't recognize TAB other than as an actual TAB character if you hold down CTRL while you hit it. Second, each InputText measure / field is a single, stand alone entity. They don't know or care about each other. There is no concept of a single "form" with multiple input fields that you can tab or click back and forth between, input information in them, and just click on "submit" to cause them both to be "entered".

However we can get moderately close to the behavior you want. The idea is to get the input from the user on the first InputText measure, and as a part of the Command1 option, have it fire the second InputText measure. When you are done, you will have two InputText measures that will have string values that you can use any way you want.

Note that there is no easy way to ensure what is entered is a "number". Some complicated checking could be done after both InputText measures have fired using one or more Calc measures to test that the value of the InputText measures are greater than "0", but I won't go into that here.

Also note that there is no way with this approach to have the "second" input filled in and used, unless the "first" input is completed. If you bail out on the first, the second is never fired. This is actually good in my opinion. You could use an OnDismissAction on the first InputText measure that would fire the second one anyway, but I think the user-facing behavior could get weird pretty quick. I mean I think you either want one click to cause both values to be entered by the user, or just leave it as two distinct clicks and actions, and none of this idea is really needed.

So here is an example:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[MeterInputPlaceHolder1]
Meter=Image
X=0
W=100
H=27
SolidColor=47,47,47,255
LeftMouseUpAction=!CommandMeasure "MeasureInput1" "ExecuteBatch 1-2"

[MeterInputPlaceHolder2]
Meter=Image
X=0
Y=3R
W=100
H=27
SolidColor=47,47,47,255

[MeasureInput1]
Measure=Plugin
Plugin=InputText
X=4
Y=4
W=95
H=23
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
DefaultValue=Width
Command1=$UserInput$
Command2=[!CommandMeasure "MeasureInput2" "ExecuteBatch 1-3"]

[MeasureInput2]
Measure=Plugin
Plugin=InputText
X=4
Y=33
W=95
H=23
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
DefaultValue=Height
Command1=$UserInput$
Command2=[!SetOption MeterResultImage W "[MeasureInput1]"][!SetOption MeterResultImage H "[MeasureInput2]"]
Command3=[!ShowMeter MeterResultText][!UpdateMeter *][!Redraw]

[MeterResultImage]
Meter=Image
X=0
Y=63
W=0
H=0
SolidColor=41,108,171,255
DynamicVariables=1

[MeterResultText]
Meter=String
MeasureName=MeasureInput1
MeasureName2=MeasureInput2
X=0
Y=5R
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
Text=Width: %1  Height: %2
Hidden=1
test.gif
So what we do is fire the first input field when the placeholder meter is clicked, which creates the field and collects the user input with "$UserInput$". It then simply sends a !CommandMeasure to the second InputText measure, which fires that one.

Then the second input field is created and the user input is collected with "$UserInput$". It then simply uses !SetOption with the current value of the InputText measures to set the size of an image, and "unhides" a meter we will use to display the results.

You should be able to work this approach into what you are trying to do, with some limitations. You could "collect" the user input for the numbers in the UserInput measures and have a separate "submit" meter that uses their values to take the actions you want. Nothing says that the CommandN options have to do anything themselves, other than get the user input. However the key is that nothing is created in the measure unless enter is hit.
You do not have the required permissions to view the files attached to this post.