| View previous topic :: View next topic |
| Author |
Message |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Mon Apr 28, 2003 10:35 am Post subject: Edit (how can i limit the amount of chars?) |
|
|
How can i limit the amount of input an edit box can take?
I want to make say edit 1 accept no more then 255 chars input. |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Mon Apr 28, 2003 12:47 pm Post subject: |
|
|
I though i could use sendmessage but that bring me to the question whats the Windows API code that goes in there? I only know how to make a list box have scrolls, thats the limit to my API.
Any help please? |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Mon Apr 28, 2003 1:21 pm Post subject: |
|
|
I admit i only did a quick search since i was not sure what i was looking for exactly.
Thank you for your help though. |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Apr 28, 2003 6:37 pm Post subject: |
|
|
I think I posted an example a year or so back that limits the text
without using the @sendmsg(). I think a couple of other people also
did small examples in the same thread as where I posted my example.
It was simply a loop where it kept checking the @len(@dlgtext(EDIT1))
and if was over the limit, it would cut off any text beyond the limit.
This is actually very simple, well, to me it is. If you can't figure it out,
just say so, and I'll make another example and post here for you.
-Garrett |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Mon Apr 28, 2003 6:51 pm Post subject: |
|
|
Probably something like this...
| Code: | DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG ADD,EDIT,EDIT1,89,49,,,EDIT1
DIALOG SHOW
:Evloop
wait event,0.1
goto @event()
:Timer
dialog set,edit1,@substr(@dlgtext(edit1),1,10)
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Apr 28, 2003 7:29 pm Post subject: |
|
|
I was searching for the old posts on this, but I think they may have been
prior to this forum being setup. So here's a new example for you:
| Code: | DIALOG CREATE,Limit Input,-1,0,212,53
DIALOG ADD,EDIT,EDIT1,16,14,180,19,EDIT1
DIALOG SHOW
Option Sleeptime,100
%%InLimit = 10
:EventLoop
Wait Event,0
Goto @event()
:Close
Exit
:Timer
If @greater(@len(@dlgtext(EDIT1)),%%InLimit)
Dialog Set,EDIT1,@substr(@dlgtext(EDIT1),1,%%InLimit)
WARN "You have exceeded the limit of this entry. Entry truncated to fit within entry limits."
End
Goto EventLoop |
-Garrett |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Apr 28, 2003 7:43 pm Post subject: |
|
|
I posted an example just for this in the knowledge base a while ago!
http://forum.vdsworld.com/viewtopic.php?t=1316
It has an example and everything you need.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Tue Apr 29, 2003 1:00 pm Post subject: |
|
|
| Thank you, I have managed to do what i was doing with my edit box. |
|
| Back to top |
|
 |
|