It is currently April 26th, 2024, 7:46 am

Text editor skin?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text editor skin?

Post by Yincognito »

death.crafter wrote: February 11th, 2022, 5:02 am It's Shift + Enter.

Only Enter saves the file. I just modified my example skin a bit to make this. So didn't put much into functionalities.

Also, yeah, I made this to over come the lacunas of InputText. But when actually making it, I realized multiline input is harder to make. I will try to perfect it later sometime, as I am busy with other things. I just released the plugin in case someone else is able to make it.
Ah, it makes sense, thanks, all working great now. No pressure, take your time, better to be done well than hurry up and have to correct various things here and there later on. Nice job! :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Active Colors
Moderator
Posts: 1254
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

Just recalled about the multi-line text "editor" skin. It doesn't use InputText plugin though, instead it uses custom made .exe.
It is a part of the suite Kotoko created by ~Faradey~ / FaradeyUA who also created bunch of addons in the past: https://www.deviantart.com/faradeyua/art/Kotoko-Suite-v5-0-1-Beta-714888480
https://forum.rainmeter.net/viewtopic.php?t=15975

The skin is quite complicated and obfuscated with a bunch of lua files. I couldn't make an example skin out of it.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text editor skin?

Post by Yincognito »

Active Colors wrote: March 16th, 2022, 1:15 pm Just recalled about the multi-line text "editor" skin. It doesn't use InputText plugin though, instead it uses custom made .exe.
It is a part of the suite Kotoko created by ~Faradey~ / FaradeyUA who also created bunch of addons in the past: https://www.deviantart.com/faradeyua/art/Kotoko-Suite-v5-0-1-Beta-714888480
https://forum.rainmeter.net/viewtopic.php?t=15975

The skin is quite complicated and obfuscated with a bunch of lua files. I couldn't make an example skin out of it.
I found the solution to one two of the issues, the others you mentioned should be posted as bugs if no alternative is found. Based on what has been posted here and in all that thread, simple multiline InputText:

Code: Select all

[Variables]
DefaultText=Hello There![\13][\10]How Are You?
; CTRL + ENTER for a new line, ENTER to commit

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255
SkinWidth=600
SkinHeight=600

---Measures---

[InitInputs]
Measure=Calc
IfCondition=1
IfTrueAction=[!SetOptionGroup InputTextGroup FontFace "Consolas"][!SetOptionGroup InputTextGroup SolidColor "0,0,0,255"][!SetOptionGroup InputTextGroup FontColor "255,255,255,255"][!SetOptionGroup InputTextGroup FontSize 16][!SetOptionGroup InputTextGroup AntiAlias 1][!SetOptionGroup InputTextGroup ClipString 1]
UpdateDivider=-1
DynamicVariables=1

[TextInput]
Group=InputTextGroup
Measure=Plugin
Plugin=InputText
X=[Text:X]
Y=[Text:Y]
W=[Text:W]
H=[Text:H]
DefaultValue=[#DefaultText]
UpdateDivider=-1
Command1=[!SetVariable DefaultText "$UserInput$"][!WriteKeyValue Variables DefaultText "[#CURRENTSECTION#]"]
Command2=[!UpdateMeasure *][!UpdateMeter *][!Redraw]
Command3=[]
OnDismissAction=[]
RegExpSubstitute=1
Substitute="\r\n":"[*\13*][*\10*]"
DynamicVariables=1

---Meters---

[Text]
Meter=String
X=10
Y=10
W=580
H=580
SolidColor=0,0,0,128
FontFace=Consolas
FontColor=255,255,255,255
FontSize=16
AntiAlias=1
ClipString=1
Text=[#DefaultText]
UpdateDivider=-1
LeftMouseUpAction=[!CommandMeasure TextInput "ExecuteBatch All"]
DynamicVariables=1
InputTextMultiLine.jpg
Also, a simple way of dealing with the new line character, but this time using Lua, here (simpler than the similar way eclectic-tech mentioned earlier, IMHO). As I said in the screenshot (thought of having a lil' fun with it, LOL), the question remains on the copy paste thingy and the other bug you talked about... :???:

EDIT: Updated code to solve point 2) in your post here as well. Now only the copy paste / duplicate contents bug, aka your point 1), remains ... if it wasn't an effect of the other two issues, that is. Let me know if it's still there with the code above.

EDIT2: Just noticed I had a leftover measure called NewLineConverter in the code from my previous tests. I removed it, as it serves no purpose.
You do not have the required permissions to view the files attached to this post.
Last edited by Yincognito on March 16th, 2022, 9:12 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
creewick
Posts: 38
Joined: March 4th, 2022, 2:43 pm
Location: Almaty, Kazakhstan

Re: Text editor skin?

Post by creewick »

Yincognito wrote: March 16th, 2022, 5:49 pm I found the solution [...]
This is an amazing solution to the problem!

I was trying to realise something similar in my skin. At first, I thought to convert the text twice:

1) after any input, replace any \r\n to any non-printing symbol, to make the value one-liner
2) on skin refresh, replace any non-printing symbol to [\13][\10] as was described in this thread

I didn't knew that it was possible with one convertion :o
Yincognito wrote: March 16th, 2022, 5:49 pm Substitute="\r\n":"[*\13*][*\10*]"
I don't quite understand how * symbols are working in this example. Is it some kind of escape sequence?
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text editor skin?

Post by Yincognito »

creewick wrote: March 16th, 2022, 8:34 pm This is an amazing solution to the problem!

I was trying to realise something similar in my skin. At first, I thought to convert the text twice:

1) after any input, replace any \r\n to any non-printing symbol, to make the value one-liner
2) on skin refresh, replace any non-printing symbol to [\13][\10] as was described in this thread

I didn't knew that it was possible with one convertion :o

I don't quite understand how * symbols are working in this example. Is it some kind of escape sequence?
Glad you like it. Yes, those symbols are an escape sequence for section variables.

P.S. The nice thing is that those [\13][\10] (by the way, [\10][\13] won't work, since this is CR+LF, aka 13+10) act the same way as #CRLF# "should" in both Rainmeter code and the InputText measure. They don't break lines for variables when escaped, but they break lines in an input text box. Care should be taken at escaping them ([\\13][\\10] works here too, but NOT [*\13*][*\10*] !!!) when writing texts in an InputText measure.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text editor skin?

Post by Yincognito »

One last thought ... it is possible, for a limited number of times, to use ENTER and not CTRL + ENTER to add new lines, by repeating stuff where the $UserInput$ macro is used like explained in the manual, but unfortunately I didn't find a way to "save" the current progress and use it in the next "iteration" (yet), so I'm sharing the method in case someone else has another idea. Basically all you need to do is continue to use $UserInput$ in additional commands, and adding the "ENTER" afterwards (obviously, like said before, couldn't see a way to "join" these pieces of text, since apparently $UserInput$ is somewhat "reset" on each use in the same measure):

Code: Select all

Command1=[!SetVariable DefaultText "$UserInput$[*\13*][*\10*]"]
Command2=[!UpdateMeasure *][!UpdateMeter *][!Redraw]
Command3=[!SetVariable DefaultText "$UserInput$[*\13*][*\10*]"]
Command4=[!UpdateMeasure *][!UpdateMeter *][!Redraw]
P.S. Also, just for reference, if one want to use quotes in the edited text, he should use these as commands instead (the saved string will be enclosed in quotes as well, to prevent stubborn Rainmeter from stripping off other possible quotes at the start or end of the string - remember, the user is in control, right?):

Code: Select all

Command1=[!SetVariable DefaultText """$UserInput$"""][!WriteKeyValue Variables DefaultText """"[#CURRENTSECTION#]""""]
Command2=[!UpdateMeasure *][!UpdateMeter *][!Redraw]
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
creewick
Posts: 38
Joined: March 4th, 2022, 2:43 pm
Location: Almaty, Kazakhstan

Re: Text editor skin?

Post by creewick »

I had also noticed that InputText measure doesn't allow you to enter any input, if the command doesn't contains $UserInput$

I was trying to do something like this:

Code: Select all

[Variables]
Content=My note

[Meter]
Meter=String
Text=#Content#
LeftMouseUpAction=[!CommandMeasure "Input" "ExecuteBatch ALL"]

[Input]
Measure=Plugin
Plugin=InputText
DefaultValue=#Content#
RegExpSubstitute=1
Substitute="\r\n":"[*\13*][*\10*]"
Command1=[!WriteKeyValue Variables Content """[#CURRENTSECTION#]"""][!Refresh]
Because [!WriteKeyValue Variables Content """$UserInput$"""] writes the initial input, without substituting it, and that is not what I need
The code above doesn't allow me to enter any text, but it works like this:

Code: Select all

[Variables]
Content=My note

[Meter]
Meter=String
Text=#Content#
LeftMouseUpAction=[!CommandMeasure "Input" "ExecuteBatch ALL"]

[Input]
Measure=Plugin
Plugin=InputText
DefaultValue=#Content#
RegExpSubstitute=1
Substitute="\r\n":"[*\13*][*\10*]"
Command1=[!SetVariable NewValue "$UserInput$"][!WriteKeyValue Variables Content """[#CURRENTSECTION#]"""][!Refresh]
Although I don't use NewValue anywhere else
User avatar
Active Colors
Moderator
Posts: 1254
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Text editor skin?

Post by Active Colors »

GIF 17-03-2022 11-52-40.gif
Yincognito wrote: March 16th, 2022, 5:49 pm the others you mentioned should be posted as bugs
Which one are you referring to?
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text editor skin?

Post by Yincognito »

creewick wrote: March 17th, 2022, 8:21 am I had also noticed that InputText measure doesn't allow you to enter any input, if the command doesn't contains $UserInput$

I was trying to do something like this:

Code: Select all

[Variables]
Content=My note

[Meter]
Meter=String
Text=#Content#
LeftMouseUpAction=[!CommandMeasure "Input" "ExecuteBatch ALL"]

[Input]
Measure=Plugin
Plugin=InputText
DefaultValue=#Content#
RegExpSubstitute=1
Substitute="\r\n":"[*\13*][*\10*]"
Command1=[!WriteKeyValue Variables Content """[#CURRENTSECTION#]"""][!Refresh]
Because [!WriteKeyValue Variables Content """$UserInput$"""] writes the initial input, without substituting it, and that is not what I need
The code above doesn't allow me to enter any text, but it works like this:

Code: Select all

[Variables]
Content=My note

[Meter]
Meter=String
Text=#Content#
LeftMouseUpAction=[!CommandMeasure "Input" "ExecuteBatch ALL"]

[Input]
Measure=Plugin
Plugin=InputText
DefaultValue=#Content#
RegExpSubstitute=1
Substitute="\r\n":"[*\13*][*\10*]"
Command1=[!SetVariable NewValue "$UserInput$"][!WriteKeyValue Variables Content """[#CURRENTSECTION#]"""][!Refresh]
Although I don't use NewValue anywhere else
Yes, $UserInput$ triggers the input text to enter its edit mode. Your way works fine in your case because you immediately refresh, but if you didn't, you'd see that a [!SetVariable Content "$UserInput$"] instead of using NewValue is what makes the input text to display the correct, updated text, after pressing ENTER to commit changes in the box. Since Content is a variable you use exclusively for the input text measure and the string meter content (where the substitution isn't required), I'd say this is the right way to do things. In your case, the refresh bang saves you from seeing the result afterwards, so it doesn't matter, but without that bang, setting the Content variable is a must.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Text editor skin?

Post by Yincognito »

Active Colors wrote: March 17th, 2022, 10:51 am GIF 17-03-2022 11-52-40.gif


Which one are you referring to?
Well, since it's the only one that's left, the one with copy pasting duplicating lines - number 1) here. Also, care to share how you managed to make InputText use the previously saved content after pressing ENTER?

And yes, I know the text remains selected - I did a bunch of tests the other day on this whole thing. My idea is to take things one at a time: first, using the previously saved content after pressing enter (which it seems that you succeeded in doing), and only then bother with the need for a DOWN key or CLICK to unselect text. In other words, I saw the first issue the most difficult. Now if you share your method, maybe we'll find a solution to the selection as well... :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth