Source language: Translate to:

Finish Text Enty Field With Enter Key

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Finish Text Enty Field With Enter Key

Postby Horst Helfen » Tue Jul 11, 2017 4:31 am

Hello,

I have a TextEntry field and want to finish the entry with ENTER. How can I achieve that my actions begin to work after pressing the ENTER key?
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Re: Finish Text Enty Field With Enter Key

Postby Gaev » Tue Jul 11, 2017 5:14 am

Horst Helfen:

If you define the style of your TextEntry box as a Multiline (no Scroll bars, no Word wrap) ... and make its height just enough to show one line of text ... in other words, make it look (to the user) like a [i]singleline[i] box ... then you can use code like this in the Text Change event section ...
Code: Select all
SearchStr "[#13][#10]" "[TextEntry1]" "[EnterKeyPos]" ""
If "[EnterKeyPos]" ">" "0"
    StrReplace "[TextEntry1]" "[#13][#10]" "" "[TextEntry1]" ""
    ... do Enter key processing here
    AlertBox "Info" "Enter Key was pressed"
EndIf
User avatar
Gaev
 
Posts: 3674
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Finish Text Enty Field With Enter Key

Postby Horst Helfen » Tue Jul 11, 2017 5:58 am

Thank you Gaev for your quick answer. That works fine.
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Re: Finish Text Enty Field With Enter Key

Postby virger » Tue Jul 11, 2017 8:16 am

Tray this

Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=9
Name=TexEnt
X=34
Y=73
W=283
H=133
Anchor=0
VarName=[Tx]
Align=1
EditMultiLine=Yes
EditLen=0
ObjAction=GetObjectInfo "TexEnt" "CursorPosition" "[ps]"¶substr "[tx]" "[ps]-1" "1" "[ch]"¶if  "[ch]" "=" "[#10]"¶    alertbox "" "enter.."¶endif
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=7
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 466
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron