Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: character limitation  (Read 3502 times)

0 Members and 1 Guest are viewing this topic.

maze

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 59
  • Good news
    • View Profile
character limitation
« on: August 11, 2008, 10:48:48 AM »

Hi Guy's,

I have a static in a window. In this static I load different text from variables. Some of the text is too long, so I want to limit the number of characters that's been shown in the static.
I know that variable.Length show me the number of characters, but I don't know how to limit the number of characters.
Is there anyone out, who could give me the right idea?

It would be a nice feature in WindowEdit to limit the number of characters for statics and buttons, just like MaxLength attribute for editors, wouldn't it?

Thanks
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: character limitation
« Reply #1 on: August 11, 2008, 11:22:34 AM »

how about something like (untested) this?

Code: WME Script
  1. var MaxLength = 50;
  2. var q = new String(YourVariable);
  3. var q2 = q.Substr(0,MaxLength);
  4. YourStatic.Text = q2;
  5.  
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

maze

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 59
  • Good news
    • View Profile
Re: character limitation
« Reply #2 on: August 11, 2008, 11:33:05 AM »

Thanks for the quick reply, I'm going to check it out.
I think it brings me back on the way  ::rock
Logged

maze

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 59
  • Good news
    • View Profile
Re: character limitation
« Reply #3 on: August 11, 2008, 11:40:22 AM »

Thanks again, it's working pretty well
Logged
 

Page created in 0.026 seconds with 21 queries.