Source language: Translate to:

How to make multi-line text entry box ENTER

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

How to make multi-line text entry box ENTER

Postby schmutly » Wed Aug 21, 2013 7:01 pm

Hello gang.
When i type in a multiline text entry box i want to be able to type a few lines,
hit enter and it THEN send text to an action in another,say button.
If i setup a text box with no mutiline selected and have another button
setup with the shortcut key ENTER..then when i hit enter in the text box
the button clicks down, but i cant simulate this with a mutliline as when
you hit ENTER in a mutliline it goes to next line, fair enough..i want to
override this as its a pain after typing to move mouse to button to click.
Thanks for your help,
Robbie
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: How to make multi-line text entry box ENTER

Postby dpayer » Thu Aug 22, 2013 7:43 am

On the Mouse Enter section of the Actions screen, start a timer @10 Milliseconds.

Search the string you are creating in the multiline text object for a carriage return [#13]. If found, cause an action to do what you want.

David P.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: How to make multi-line text entry box ENTER

Postby Gaev » Thu Aug 22, 2013 5:27 pm

schmutly:

Whenever the user presses the "Enter" key, the variable associated with the TextEntry box will store [#13][#10] as its value.

So you can achieve your objective by placing this code in the TextEntry object's Text Change event section ...
Code: Select all
SearchStr "[#13][#10]" "[TextEntry17]" "[EnterKeyPos]" ""
If "[EnterKeyPos]" ">" "0"
    StrReplace "[TextEntry17]" "[#13][#10]" "" "[TextEntry17]" ""
    ... do Enter key processing here
    AlertBox "Info" "Enter Key was pressed"
EndIf

Note that if the user were to paste (from the Clipboard) some text containing multiple lines, the end result may not be desireable.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: How to make multi-line text entry box ENTER

Postby schmutly » Thu Aug 22, 2013 6:32 pm

Thanks guys :)
Ill try both of these and report back.
Cheers,
Robbie

EDIT:
Ok, that works great Gaev, thanks ;P
Thanks David, looks like you both were
on the same page too lol, thanks again.
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: How to make multi-line text entry box ENTER

Postby schmutly » Tue Jun 24, 2014 11:34 pm

Gaev wrote:schmutly:

Whenever the user presses the "Enter" key, the variable associated with the TextEntry box will store [#13][#10] as its value.

So you can achieve your objective by placing this code in the TextEntry object's Text Change event section ...
Code: Select all
SearchStr "[#13][#10]" "[TextEntry17]" "[EnterKeyPos]" ""
If "[EnterKeyPos]" ">" "0"
    StrReplace "[TextEntry17]" "[#13][#10]" "" "[TextEntry17]" ""
    ... do Enter key processing here
    AlertBox "Info" "Enter Key was pressed"
EndIf



May i ask why it doesn't seem to work if i use Single line instead of multiline? So, how can i achieve this with the
single line simply ?
Thanks,
Rob
PS: I could just turn on the "shortcut" for ENTER but i have several single line boxes and only allowed one at a time it seems ?!
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: How to make multi-line text entry box ENTER

Postby Gaev » Wed Jun 25, 2014 7:52 am

schmutly:
May i ask why it doesn't seem to work if i use Single line instead of multiline?
Because a SingleLine Text widget does not accept the Enter key ... so you do not see the [#13][#10] code for it in the associated data variable.

So, how can i achieve this with the single line simply ?
You could use a MultiLine Text widget ... only adjust its height to make it appear to the user like it is a SingleLine Text widget ... and use the TextChange event section to remove the [#13][#10].

PS: I could just turn on the "shortcut" for ENTER but i have several single line boxes and only allowed one at a time it seems ?!
If you have something against using MultiLine Text widgets ...

a) In the Gain Focus event sections of each of the SingleLine Text widgets ...
Code: Select all
SetVar "[CurrentSingleLineTextWidget]" "[self]"


b) In the Left Click event section of the (hidden) Button with the shortcut key of ENTER ...
Code: Select all
... take actions depending on value of variable [CurrentSingleLineTextWidget]
If "[CurrentSingleLineTextWidget]" "=" "ABCD"
   GoSub "EnterInABCD"
EndIf
If "[CurrentSingleLineTextWidget]" "=" "WXYZ"
   GoSub "EnterInWXYZ"
EndIf
... etc. etc.
... clear the variable
SetVar "[CurrentSingleLineTextWidget]" ""
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: How to make multi-line text entry box ENTER

Postby virger » Wed Jun 25, 2014 8:11 am

From Costa Rica
In Wordl Cup

Maybe this can help you
~~~~~~~~~~~~~~~~~~~~
.. Make a ListBox
.. ListItems == [vTx]

.. Make a TexEntry with variable == [vTx]
.. This way you can take any line
..
.. or Add This Action in TextEntry
.strlen "[vTx]" "[Len]"
.substr "[vTx]" "[Len]" "1" "[Chr]"
.if "[Chr]" "=" "[#10]"
. deletearray "[Lines]" "All"
. strparse "[vTx]" "[#13][#10]" "[Lines]" "[NumLines]"
.endif

~~~~~~~~~~~~~~~~~~~
Pura Vida
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: How to make multi-line text entry box ENTER

Postby schmutly » Wed Jun 25, 2014 4:52 pm

Thanks Gaev I'll give that a go.
Thanks also virger i'll have a look at that too.
Thanks guys,
Rob
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests