Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: New line in editor. Possible?  (Read 4572 times)

0 Members and 1 Guest are viewing this topic.

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 301
  • Sorry for any bad english in my posts. Game on !
    • View Profile
New line in editor. Possible?
« on: October 29, 2013, 07:35:40 AM »

Hello is it possible to make it so when a user hits the enter key, it will go down to a new line in the text editor field? Thanks

Logged

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: New line in editor. Possible?
« Reply #1 on: October 29, 2013, 11:22:44 AM »

As far as I can see, there is no support of formatting indetifiers in Editor field. So it's possible to try to get around the restriction by inserting spaces at the string's break, or try to find other method. For the detection of the breaking you can try the following code inside the window script.

Code: WME Script
  1. on "Keypress"
  2. {
  3.   if(Keyboard.KeyCode==VK_RETURN)
  4.   {
  5.         var edit = this.GetControl("editor");
  6.         var txt = new String(edit.Text);
  7.         var txt1 = txt.Substring(0,edit.SelEnd-1);
  8.         var txt2 = txt.Substring(edit.SelEnd, txt.Length-1);
  9.         edit.Text = txt1 + " " + txt2;
  10.   }
  11. }
Logged

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 301
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: New line in editor. Possible?
« Reply #2 on: October 29, 2013, 12:34:49 PM »

Thanks 2.0, you are always helpful. Is there a way that once the text in the textbox is outside of it, it goes to the next line? Right now of the text is outside of the bounds of the textbox, it just gets cut off. For example, if there is more letters in the text box than the length.
Logged

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: New line in editor. Possible?
« Reply #3 on: October 31, 2013, 04:01:12 PM »

Hi. While I have no specific ideas on how to work around this limitation without changing the source code, except the sketch of the idea :)
Static control have a line feed. And if a duplicate row from the editor control to the static - output similar to the correct one.

Code: WME Script
  1. on "editor"
  2. {
  3.         var edit = this.GetControl("editor");
  4.         var text = this.GetControl("text"); // Static control
  5.         text.Text = edit.Text
  6. }

But if you get rid of the editor control, it ceases to receive and send events. Perhaps the keyboard events should be handled directly in the window script and letter by letter added a in a text string of the static control. And also to manually draw the cursor over it. Other ideas while aren't present.
Logged

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 301
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: New line in editor. Possible?
« Reply #4 on: November 01, 2013, 12:46:25 PM »

Hey 2.0,

Thank you for the help. I very much appreciate it. I actually found a way to do this using a different method. I made a password protection note taking app in Wintermute and I will be submitting it to the app store soon  ::rock
Logged

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: New line in editor. Possible?
« Reply #5 on: November 01, 2013, 05:05:32 PM »

It is cool! And what the method consists of, if not a secret?
Logged

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: New line in editor. Possible?
« Reply #6 on: November 01, 2013, 06:02:29 PM »

Hey 2.0,

Thank you for the help. I very much appreciate it. I actually found a way to do this using a different method. I made a password protection note taking app in Wintermute and I will be submitting it to the app store soon  ::rock

I have had this issue for a long time, enough time to simply discard the multi-line functionality. I would really appreciate it too if you could show us the method you followed.  :)
Logged

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 301
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: New line in editor. Possible?
« Reply #7 on: November 02, 2013, 07:52:20 AM »

Simple. Just add mutiple editors, one underneath the other. When Enter is hit, or the Line.SelEnd is a certain number, it drops down to the next box. I have the graphics in place so it looks like one big box. Let me know if that helps.
Logged

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: New line in editor. Possible?
« Reply #8 on: November 03, 2013, 11:31:49 AM »

Simple. Just add mutiple editors, one underneath the other. When Enter is hit, or the Line.SelEnd is a certain number, it drops down to the next box. I have the graphics in place so it looks like one big box. Let me know if that helps.

Really very elegant and simple solution :)
Logged

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: New line in editor. Possible?
« Reply #9 on: November 03, 2013, 09:02:38 PM »

Thanks piagent, your solution looks nice and simple. I will try it asap.
Logged
 

Page created in 0.058 seconds with 21 queries.