It is currently April 25th, 2024, 3:46 pm

Using InputText without Enter

Get help with creating, editing & fixing problems with skins
Wallboy
Posts: 70
Joined: October 1st, 2012, 4:53 am

Using InputText without Enter

Post by Wallboy »

I want to use the InputText plugin like a regular line edit widget where instead of typing something in and having to hit Enter, you can instead click a button that performs an action with the text that was input.

I don't like how if you type something in and it loses focus, then everything disappears and you have to re-type it back in.

How can I simulate this functionality? Is it even possible to do what I want?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using InputText without Enter

Post by jsmorley »

Something like this perhaps:

Code: Select all

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

[Variables]

[MeterBox]
Meter=Shape
Shape=Rectangle 1,1,202,25 | Fill Color 215,215,215,255 | Stroke Color 130,130,130,255
W=202
H=25

[MeterLabel]
Meter=String
X=5
Y=5
W=200
H=23
SolidColor=0,0,0,1
FontColor=47,47,47,255
FontSize=12
AntiAlias=1
Text=Input Something
LeftMouseUpAction=[!CommandMeasure "MeasureInput" "ExecuteBatch 1"]

[MeasureInput]
Measure=Plugin
Plugin=InputText
X=1
Y=3
W=200
H=22
SolidColor=200,200,200,255
FontColor=47,47,47,255
FontSize=11
AntiAlias=1
FocusDismiss=1
UpdateDivider=-1
Command1=["$UserInput$"][!ShowMeter MeterClick]

[MeterClick]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Hidden=1
Text=[MeasureInput]
LeftMouseUpAction=[!Log "I clicked [MeasureInput]"]
So what we are doing is simply using $UserInput$ to collect the input and set the value of the measure to that text. No other action is done when you complete the input and hit enter. Then the String meter that displays this text also has a mouse action on it as needed.

Note that you still must hit Enter. That cannot be avoided. The value of the text you type in does not exist anywhere until Enter is hit. Enter is the required trigger that actually evaluates and captures the text you type in.
Wallboy
Posts: 70
Joined: October 1st, 2012, 4:53 am

Re: Using InputText without Enter

Post by Wallboy »

Hmm, I really wanted to avoid the need for Enter. It's just so unintuitive to tell a user they MUST hit Enter for this type of input box.

I guess this InputText plugin won't work for my needs. Do you know of any other 3rd party plugins that have a line edit widget like I want? Or is AutoIT scripts my next goto?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using InputText without Enter

Post by jsmorley »

Wallboy wrote: July 28th, 2019, 12:31 pm Hmm, I really wanted to avoid the need for Enter. It's just so unintuitive to tell a user they MUST hit Enter for this type of input box.

I guess this InputText plugin won't work for my needs. Do you know of any other 3rd party plugins that have a line edit widget like I want? Or is AutoIT scripts my next goto?
I don't think anything is going to work any better. There are no other input plugins that I am aware of, and AutoIt and the like can't interact with the visible aspects of Rainmeter to draw anything on the screen that Rainmeter can deal with.

You would probably have to write a C++ or C# Rainmeter plugin from scratch. Something that could produce an input box on the screen at some defined location, and return values to Rainmeter as the text is being typed.
Wallboy
Posts: 70
Joined: October 1st, 2012, 4:53 am

Re: Using InputText without Enter

Post by Wallboy »

The inputbox in question is part of a settings skin that configures a different skin. I know back in the day people would use AutoIT compiled scripts to configure settings for a skin. Not sure if that's still the case today. It's been many years since I last developed with Rainmeter.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using InputText without Enter

Post by jsmorley »

Wallboy wrote: July 28th, 2019, 12:49 pm The inputbox in question is part of a settings skin that configures a different skin. I know back in the day people would use AutoIT compiled scripts to configure settings for a skin. Not sure if that's still the case today. It's been many years since I last developed with Rainmeter.
Yes, I expect you could write something in C++, C#, AutoIt, pretty much anything that can create compiled GUI "applications" and use that to collect input as you like. Then you would have to have that application write to some file, probably a .inc file for Rainmeter, and have Rainmeter read and react to that file when you "close" the application. Guess you would have to have the application write to the file on each keystroke.
Wallboy
Posts: 70
Joined: October 1st, 2012, 4:53 am

Re: Using InputText without Enter

Post by Wallboy »

I was thinking of just sending bangs directly to rainmeter.exe as documented in the Bangs documentation. I figured that's how people were doing it from these AutoIT scripts.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using InputText without Enter

Post by jsmorley »

Wallboy wrote: July 28th, 2019, 1:24 pm I was thinking of just sending bangs directly to rainmeter.exe as documented in the Bangs documentation. I figured that's how people were doing it from these AutoIT scripts.
You can do that. Be sure you use both !SetOption / !SetVariable as needed to get dynamic changes to things, and !WriteKeyValue if you want to have the change be persistent.
Wallboy
Posts: 70
Joined: October 1st, 2012, 4:53 am

Re: Using InputText without Enter

Post by Wallboy »

Will do. Thanks for the help.