It is currently October 27th, 2021, 11:30 pm

[SUGGESTION] InputText OnFocusAction

Report bugs with the Rainmeter application and suggest features.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

[SUGGESTION] InputText OnFocusAction

Post by moshi »

i noticed that if i have an InputText plugin activated in a skin any OnUnFocusAction defined in the [Rainmeter] section of the skin will be executed.

i can see why this happens. but i do not think that this is ideal. while i no longer focus the skin window, i as a user still focus on the skin as such.

would it be possible to have some kind of OnFocusAction specifically for this plugin?
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Re: [SUGGESTION] InputText OnFocusAction

Post by Virginityrocks »

I think it's because the InputText plugin actually executes a window separate of Rainmeter. I don't know if that can be avoided.
Droptop Four
Dropdown menu bar & app launcher for Windows & Rainmeter
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: [SUGGESTION] InputText OnFocusAction

Post by moshi »

Virginityrocks wrote:I think it's because the InputText plugin actually executes a window separate of Rainmeter.
yes. i know that.
Virginityrocks wrote: I don't know if that can be avoided.
probably not. this is why i am asking for a setting for commands to be executed when this window is focused.
User avatar
jsmorley
Developer
Posts: 22374
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [SUGGESTION] InputText OnFocusAction

Post by jsmorley »

It's really not going to be possible with the way InputText is currently written. It's not a meter, nor is it another "Rainmeter window". It is a call to a Windows function that creates a standard input field control. The focus in Windows is given to the control, and is lost by the Rainmeter skin.

I doubt that any attempt to have Rainmeter execute some OnFocusAction on the InputText control itself is going to work, as while the control is active, Rainmeter is basically "out of the loop" until you either hit enter to submit the data, or hit escape to dismiss the field.

No action that you would take based on the "focus" of the input control is going to be seen by Rainmeter until you are done with the control.

We will take a look at the code for InputText when we get a chance, but I would not expect any real change until and unless we really rework this plugin.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: [SUGGESTION] InputText OnFocusAction

Post by moshi »

it sure could use a little attention. as an LSXCommand fan, i really miss features like a history or tab micro-complete and also things from the looks department as a transparent edit box.
the pre-xPaintClass source is still available at ShellFront if that would be useful for getting some ideas: http://modules.shellfront.org/source/lsxcommand-1.9.3-source.zip
User avatar
jsmorley
Developer
Posts: 22374
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [SUGGESTION] InputText OnFocusAction

Post by jsmorley »

While InputText works well enough with the limitations it has, none of us are particularly thrilled with the current implementation. Given all the other priorities and time constraints on the folks doing the actual coding, I don't expect anything in the near-term, but I wouldn't mind a complete re-thinking of how we get "input" from users in the context of a skin.
User avatar
Cariboudjan
Posts: 195
Joined: May 12th, 2019, 8:55 am

Re: [SUGGESTION] InputText OnFocusAction

Post by Cariboudjan »

Bump many many years later. (Wow, it's been 8 years?!)

Would love for the InputText plugin to be redone for better functionality, eg:
  • InputText box fields do not trigger OnUnfocusActions
  • Fields exist inside of the current Rainmeter skin/window
  • Transparent backgrounds for the text fields that do not affect text transparency
  • Pressing enter not required to send a command
  • Ability to use a bang to trigger the $UserInput$ of a text field (To create things like "Submit", "Search", or "Log in" buttons with multiple text fields, like Gmail username & password)
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [SUGGESTION] InputText OnFocusAction

Post by Yincognito »

Cariboudjan wrote: July 27th, 2021, 4:35 am Bump many many years later. (Wow, it's been 8 years?!)

Would love for the InputText plugin to be redone for better functionality, eg:
  • InputText box fields do not trigger OnUnfocusActions
  • Fields exist inside of the current Rainmeter skin/window
  • Transparent backgrounds for the text fields that do not affect text transparency
  • Pressing enter not required to send a command
  • Ability to use a bang to trigger the $UserInput$ of a text field (To create things like "Submit", "Search", or "Log in" buttons with multiple text fields, like Gmail username & password)
There could be many improvements that could be done to the InputText functionality (not sure it's possible for the plugin itself, since it's all about a Windows - and not Rainmeter's - textbox floating in the skin), but a very basic / rudimentary functionality can be achieved using the HotKey plugin:

Code: Select all

[Variables]
Key=
CursorPattern0=\|$
CursorPattern1=^$
CursorPatternIndex=0

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

---Measures---

[a]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[SHIFT A]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[s]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[SHIFT S]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[d]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[SHIFT D]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[BACKSPACE]
Measure=Plugin
Plugin=HotKey
HotKey=#CURRENTSECTION#
KeyDownAction=[!SetVariable Key "#CURRENTSECTION#"][!UpdateMeasure Text][!UpdateMeter Input][!Redraw][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1

[Text]
Measure=String
String=[Text][\x200B]#Key#
RegExpSubstitute=1
Substitute="(?siU)(?:.[\x200B])?BACKSPACE$":"","(?siU).[\x200B]SHIFT (.)":"\1","[\x200B]":""
UpdateDivider=-1
DynamicVariables=1

---Meters---

[Background]
Meter=Image
SolidColor=47,47,47,255
W=400
H=100

[Input]
Meter=String
X=10r
Y=10r
W=380
H=26
FontFace=Consolas
FontSize=16
SolidColor=0,0,0,255
FontColor=255,255,255,255
AntiAlias=1
MeasureName=Text
Text="%1|"
InlineSetting=Color | 0,0,0,255
InlinePattern=[#CursorPattern[#CursorPatternIndex]]
OnUpdateAction=[!SetVariable CursorPatternIndex (1-#CursorPatternIndex#)]
DynamicVariables=1
This only deals with A, S, D (both caps and no caps) and BACKSPACE and it would take some time / work to improve it (and even then I'm not sure it can be feasibly made to replicate all the features of a Windows textbox, e.g. cursor and text position relative to the input "box", copy paste features, etc.), but as a proof of concept it works...
User avatar
Cariboudjan
Posts: 195
Joined: May 12th, 2019, 8:55 am

Re: [SUGGESTION] InputText OnFocusAction

Post by Cariboudjan »

Would love it if at least Rainmeter were changed to ignore focus to an Input Text Box entirely. Leaving the existing OnFocus/OnUnfocus actions untriggered while the Input Text Box has focus in windows.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [SUGGESTION] InputText OnFocusAction

Post by Yincognito »

Cariboudjan wrote: August 3rd, 2021, 3:00 pm Would love it if at least Rainmeter were changed to ignore focus to an Input Text Box entirely. Leaving the existing OnFocus/OnUnfocus actions untriggered while the Input Text Box has focus in windows.
I don't know - the user would expect the skin's focus actions to be triggered when he clicks an input box in that same skin... :???:
Maybe this plugin by death.crafter can be of some help here?