Is it possible to limit the length of an EditControl? |
Author: |
Message: |
MeEtc
Patchou's look-alike
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://meetcweb.com/up/v.png)
In the Shadow Gallery once again
Posts: 2191 Reputation: 60
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Nov 2004
Status: Online
|
O.P. Is it possible to limit the length of an EditControl?
I'm wondering if its possible to make a maximum length of the number of characters that is possible to type into a text box?
![[Image: sharing.png]](http://www.meetcweb.com/files/sharing.png)
I cannot hear you. There is a banana in my ear.
|
|
10-21-2007 07:38 PM |
|
![](images/pixel.gif) |
vikke
Senior Member
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](avatar.php?uid=55246-6142)
Posts: 900 Reputation: 28
32 / / ![Sweden Flag](images/flags/se.png)
Joined: May 2006
|
RE: Is it possible to limit the length of an EditControl?
You code it instead:
code: var MaxLength = 100;
function On<YOUR_EDIT_ID_HERE>Event_EditTextChanged(PlusWnd, ControlId)
{
var Text = PlusWnd.GetControlText(ControlId);
if(Text.length > MaxLength)
{
PlusWnd.SetControlText(ControlId, Text.substr(0, MaxLength));
}
}
I havn't tried it but I think it should work. If it doesn't, I hope you get the idea.
Edit: if you want to add a beep you could use this function.
code: function Beep(frequency, duration)
{
Interop.Call("Kernel32.dll", "Beep", frequency, duration);
}
This post was edited on 10-21-2007 at 07:59 PM by vikke.
|
|
10-21-2007 07:50 PM |
|
![](images/pixel.gif) |
Mike
Elite Member
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://mike.thedt.net/images/temp/random.php)
Meet the Spam Family!
Posts: 2794 Reputation: 48
32 / / ![Greece Flag](images/flags/gr.png)
Joined: Mar 2003
|
RE: Is it possible to limit the length of an EditControl?
quote: Originally posted by vikke
Edit: if you want to add a beep you could use this function.
code:function Beep(frequency, duration)
{
Interop.Call("Kernel32.dll", "Beep", frequency, duration);
}
Beep will use the computer speaker to generate a sound.
If you want to use a waveform sound, you have to use MessageBeep.
|
|
10-21-2007 09:22 PM |
|
![](images/pixel.gif) |
TYL3R
Junior Member
![*](images/star.gif) ![*](images/star.gif)
![Avatar](avatar.php?uid=61398-2976)
MP!L Scripter =]
Posts: 24 Reputation: -4
31 / / ![United States Flag](images/flags/us.png)
Joined: Oct 2006
|
RE: Is it possible to limit the length of an EditControl?
Beep doesn't use the speaker to generate a sound.
It uses the sound card or something.
|
|
10-21-2007 09:40 PM |
|
![](images/pixel.gif) |
MeEtc
Patchou's look-alike
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://meetcweb.com/up/v.png)
In the Shadow Gallery once again
Posts: 2191 Reputation: 60
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Nov 2004
Status: Online
|
O.P. RE: Is it possible to limit the length of an EditControl?
Heh, thanks. All I need was the text field limit, thanks
![[Image: sharing.png]](http://www.meetcweb.com/files/sharing.png)
I cannot hear you. There is a banana in my ear.
|
|
10-21-2007 09:47 PM |
|
![](images/pixel.gif) |
deAd
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](avatar.php?uid=52958-6986)
Posts: 1060 Reputation: 28
– / / ![United States Flag](images/flags/us.png)
Joined: Jan 2006
|
RE: Is it possible to limit the length of an EditControl?
If you're not limiting it based on a specific pattern, then it'd be better to just use EM_LIMITTEXT.
|
|
10-21-2007 09:56 PM |
|
![](images/pixel.gif) |
MeEtc
Patchou's look-alike
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://meetcweb.com/up/v.png)
In the Shadow Gallery once again
Posts: 2191 Reputation: 60
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Nov 2004
Status: Online
|
O.P. RE: Is it possible to limit the length of an EditControl?
Actually, it is a pattern of sorts. The text field is going to be for a hex colour value
![[Image: sharing.png]](http://www.meetcweb.com/files/sharing.png)
I cannot hear you. There is a banana in my ear.
|
|
10-21-2007 09:58 PM |
|
![](images/pixel.gif) |
felipEx
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
Posts: 378 Reputation: 24
36 / / ![Mexico Flag](images/flags/mx.png)
Joined: Jun 2006
|
RE: Is it possible to limit the length of an EditControl?
quote: Originally posted by MeEtc
I'm wondering if its possible to make a maximum length of the number of characters that is possible to type into a text box?
something like this? =]
code: PlusWnd.SendControlMessage("YourEditControlId", 0xC5 /*EM_LIMITTEXT*/, 6 /*new length*/, 0);
This post was edited on 10-21-2007 at 10:02 PM by felipEx.
|
|
10-21-2007 10:01 PM |
|
![](images/pixel.gif) |
deAd
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](avatar.php?uid=52958-6986)
Posts: 1060 Reputation: 28
– / / ![United States Flag](images/flags/us.png)
Joined: Jan 2006
|
RE: RE: Is it possible to limit the length of an EditControl?
quote: Originally posted by MeEtc
Actually, it is a pattern of sorts. The text field is going to be for a hex colour value
For patterns it's better to monitor each character as it's entered so you can determine if it fits the pattern and then cancel it ![:)](images/smilies/msn_happy.gif)
|
|
10-21-2007 10:27 PM |
|
![](images/pixel.gif) |
|