Source language: Translate to:

StrIns in a special line

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

StrIns in a special line

Postby Siegmar » Tue Sep 26, 2006 2:57 pm

Hello, I want to make a Text-Format bold Button. It effects my TextEntry-Object 'HomeText1'.

Code: Select all
GetObjectInfo "HomeText1" "SelectedText" "[SELECTED]"
StrLen "[Selected]" "[LEN]"
SearchStr "[Selected]" "[HomeText1]" "[POS]"
Math "[POS]+[LEN]" "0" "[POSZ]"
StrIns "</b>" "[HomeText1]" "[POSZ]" "[HomeText1]"
StrIns "<b>" "[HomeText1]" "[POS]" "[HomeText1]"


So far so good. It works. But only for the first string found. If the selected string is Line 34 and it also exists in line 2, StrIns goes to line 2.

I know about hpwLineNumber, but I don't know how to let StrIns move to the LineNumber.

I think, the answer will be very simple, but now I am too confused, because I haven't found a solution.

Thanks in advance
[/code]
User avatar
Siegmar
 
Posts: 23
Joined: Tue Sep 12, 2006 11:19 am
Location: Duisburg, Germany

Postby Sam Cox » Tue Sep 26, 2006 3:31 pm

Look into the companion command
Code: Select all
GetObjectInfo "HomeText1" "CursorPosition" "[Position]"

which returns an integer value indicating the location of the selected text. I haven't played with this function much—the cursor position returned seems to be the location of the cursor at the end of the selected text—but I'm sure this is what you need to figure which of several otherwise identical sections of text was, in fact, selected.

Hope this helps,
-- Sam
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Postby Siegmar » Tue Sep 26, 2006 3:34 pm

Aaaaah!

YES! That was, what I was looking for. It works!

Thank you very much, Sam!
User avatar
Siegmar
 
Posts: 23
Joined: Tue Sep 12, 2006 11:19 am
Location: Duisburg, Germany


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron