hpwPlusMemo Get current line - Forum

Forum Navigation
You need to log in to create posts and topics.

hpwPlusMemo Get current line

Hi, In hpwPlusMemo plugin how can I get whole line where cursor is on it somewhere...
I can find position of line start by this code:

Math "[PlusMemo_SelStart]-[PlusMemo_CurLinePos]" "0" "[start_of_line]"

But I don't know how to find end of line, so I can use hpwPlusMemoGetText
Can you give me some hint please? @hpw

Regards.

Hello,

Tested in my demo pub and with the help of hpwControl

Math "[RPlusMemo1_SelStart]-[RPlusMemo1_CurLinePos]" "0" "[Start_of_Line]"
hpwStrSearch "[#13]" "[TextEntry3]" "[Start_of_Line]" "False" "[End_of_Line]"
hpwPlusMemoGetText "RPlusMemo1" "[Start_of_Line]" "[End_of_Line]-[Start_of_Line]" "[GetTextResult]"

Regards

Hans-Peter

 

Vadim and noyzen have reacted to this post.
Vadimnoyzen

Thanks for help I was thinking about same way to do the job. now I'm going to try this solution :)

I used this code to do the job:

Math "[Script_SelStart]-[Script_CurLinePos]" "0" "[Start_of_Line]"
hpwPlusMemoGetText "Script" "[Start_of_Line]" "[Script_ByteCount]" "[look_for_line]"
SearchStr "[#13]" "[look_for_line]" "[End_of_Line]" ""
hpwPlusMemoGetText "Script" "[Start_of_Line]" "[End_of_Line]" "[the_line]"

But problem is this code can't get last line which don't have a [#13]

I'm still working to find a way...

Yattaaa! :)

Math "[Script_CurLine]+1" "0" "[current_line_number]"
If "[current_line_number]" "=" "[Script_LineCount]"
    Math "[Script_SelStart]-[Script_CurLinePos]" "0" "[Start_of_Line]"
    hpwPlusMemoGetText "Script" "[Start_of_Line]" "[Script_ByteCount]" "[the_line]"
Else
    Math "[Script_SelStart]-[Script_CurLinePos]" "0" "[Start_of_Line]"
    hpwPlusMemoGetText "Script" "[Start_of_Line]" "[Script_ByteCount]" "[look_for_line]"
    SearchStr "[#13]" "[look_for_line]" "[End_of_Line]" ""
    hpwPlusMemoGetText "Script" "[Start_of_Line]" "[End_of_Line]" "[the_line]"
EndIf

Here we go... this code is working like a charm.

Also I made a function to do this job easily, attached to this post.

Uploaded files:
  • You need to login to have access to uploads.
luishp and Vadim have reacted to this post.
luishpVadim