View previous topic :: View next topic |
Author |
Message |
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Wed Jan 14, 2004 12:29 pm Post subject: NUMERIC editbox style |
|
|
Hi,
I would like to have a NUMERIC editbox style, so the user could only enter numbers in an edit box.
I did some testing with a loop that checks if there are some non-numeric symbols in the editbox, and then deletes them, but this doesn't work quick enough.
Someone who would types very fast could still cause the application to hang
Thanks,
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Jan 14, 2004 2:48 pm Post subject: |
|
|
hi vic,
have you had a look at the api's?...i know that an api can set for editboxes to have only a certain number of characters...may be there is one where only numeric characters are allowed
another thing you could do is instead of removing non-numeric entries just use a check using @numeric() and if it returns false then let the user know giving them a chance to fix up their entry
serge _________________
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Jan 14, 2004 2:56 pm Post subject: |
|
|
hi vic,
so much for my api idea...just had a quick look and found nothing...sorry!
serge _________________
|
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Jan 14, 2004 4:00 pm Post subject: |
|
|
Not exactly sure what you're doing here, but why can't
ya just check if the entry is numeric before processing it?
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Jan 14, 2004 4:02 pm Post subject: |
|
|
Maybe you should try this? The original topic can be found [ here ].
Code: | # http://yokohama.cool.ne.jp/chokuto/urawaza/api/CreateWindowEx.html
DIALOG CREATE,Nieuw Dialoog,-1,0,600,500
DIALOG SHOW
%%win = @strdel(@winexists(@dlgtext()),1,1)
loadlib user32
%%hButton = @lib(user32,CreateWindowExA,INT:,0,"EDIT","Numbers Only",@sum($10000000,$40000000,$2000),5,290,120,20,%%win,@sum(2024,2),0,0)
%%hButton = @lib(user32,CreateWindowExA,INT:,0,"EDIT","lowercase only",@sum($10000000,$40000000,$10),5,315,120,20,%%win,@sum(2024,2),0,0)
%%hButton = @lib(user32,CreateWindowExA,INT:,0,"EDIT","uppercase only",@sum($10000000,$40000000,$8,$1000,8388608),5,340,120,20,%%win,@sum(2024,2),0,0)
wait 50,event
freelib user32 |
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Wed Jan 14, 2004 4:40 pm Post subject: |
|
|
VDSOBJ.DLL also supports mask edits where you can limit the edit to only accept numbers. |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Jan 14, 2004 6:37 pm Post subject: |
|
|
Hi Vic
You can just change the style of VDS Edit boxes as shown in the code below.
Code: | DIALOG CREATE,New Dialog,-1,0,240,160
DIALOG ADD,EDIT,EDIT1,17,26,180,19,12345
DIALOG ADD,EDIT,EDIT2,51,26,180,19,EDIT2
DIALOG ADD,BUTTON,BUTTON1,88,13,64,51,BUTTON1
DIALOG ADD,BUTTON,BUTTON2,88,87,64,51,BUTTON2
DIALOG ADD,BUTTON,BUTTON3,88,166,64,51,BUTTON3
DIALOG SHOW
LOADLIB USER32
%%Hwnd = @STRDEL(@WINEXISTS(~EDIT1),1,1)
%A = @LIB(User32,GetWindowLongA,int:,%%Hwnd,-16)
%B = @LIB(User32,SetWindowLongA,int:,%%Hwnd,-16,@SUM($2000,%A))
FREELIB USER32
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:BUTTON1BUTTON
GOTO EVLOOP
:BUTTON2BUTTON
GOTO EVLOOP
:BUTTON3BUTTON
GOTO EVLOOP
:CLOSE
EXIT |
_________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Wed Jan 14, 2004 6:46 pm Post subject: |
|
|
Thanks CodeScript!
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Jan 14, 2004 8:00 pm Post subject: |
|
|
Wow CodeScript! Good job... How did you ever find out about those
parameters? _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Hortalonus Valued Contributor
Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Wed Jan 14, 2004 9:38 pm Post subject: |
|
|
Nice CodeScript! _________________ "ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player... |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jan 14, 2004 9:53 pm Post subject: |
|
|
FreezingFire wrote: | Wow CodeScript! Good job... How did you ever find out about those
parameters? |
CodeScript got this from the Win32 help. Here are a list of window Styles for a EditBox and their numeric values that can be used with CodeScript's script.
Code: | %%ES_AUTOHSCROLL = 128
%%ES_AUTOVSCROLL = 64
%%ES_CENTER = 1
%%ES_LEFT = 0
%%ES_LOWERCASE = 16
%%ES_MULTILINE = 4
%%ES_NOHIDESEL = 256
%%ES_NUMBER = @Sum(0,$2000)
%%ES_OEMCONVERT = @Sum(0,$400)
%%ES_PASSWORD = 32
%%ES_READONLY = @Sum(0,$800)
%%ES_RIGHT = 2
%%ES_UPPERCASE = 8
%%ES_WANTRETURN = 4096
|
In the future so that it is easier for non-API guru's like myself can everyone please post the names of the values for the parameters either as a remark or as a variable _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jan 15, 2004 4:36 am Post subject: |
|
|
Hi everyone
I just quickly pulled the constant from skit's post to show that it can be simply applied to VDS edit boxes.
I didn't bother to check win32 help or platform SDK for all constants (Thanks mindpower for that).
Does Win32 help give the value of these constants ? Atleast mine doesn't
So I had written a API constants reference for the same to avoid searching header files for them.
mindpower wrote: | In the future so that it is easier for non-API guru's like myself |
I never asked for any special titles. There are many users on this forum who are far far more knowledgible and senior in direct windows programming most of which is Win API even now. They are humble enough not to have any special titles.
It is more than fair to have that title removed from my avatar. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jan 15, 2004 6:29 am Post subject: |
|
|
I don't think he was talking about that CodeScript. He's just suggesting
to post these things in a way that allows others to be able to read and
maybe understand the code a and information a bit easier. I myself
still have hard time with the API's, and I've converted a few already,
but they were all the simple API's.
Your title with your avatar is more of a way for VDS World and users
like me to show our appreciation of all your help. It just happens that
you've been one of the most helpful with API's, hence, even I would
have referred to you as an API Guru.
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Jan 15, 2004 12:19 pm Post subject: |
|
|
you are very deserving of that title codescript
serge _________________
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jan 15, 2004 3:14 pm Post subject: |
|
|
Sorry Codescript,
I was not trying to deminish your work in anyway. You are a very good programmer and I am sure that everyone here would agree that you deserve the title that the admins of this forum has given you. I was just trying to say that we need to remember that not everyone on this board is at the same level and we need to be more mindful of this by posting and documenting our scripts better since the areas that VDS is moving into is pretty advanced.
You are correct the Help file does not have the values but if you have any Win32 C compiler you should be able to get any constant value from the header files. The header files are usually placed in the include directory under the main install directory of the C compiler. At least that is where I get them from. If you download LccWin32 or Borlands free C++ compilers you can get the header files. In the header files just search for the constant's name (ie...ES_NUMBER) and get it's value... In C/C++ a hexidecimal number is formated like so 0x2000. The 0x tells C/C++ that this should be treated as a hex string. Constants in C/C++ are usually written as so
#define ES_NUMBER 0x2000
The line above is a pre-compiler directive and is not the only way to write a constant in C you can also define a contant like so and give it a data type.
const DWORD ES_NUMBER = 0x2000;
But you usually will not find a constant written like this in a header file.
Also most programmers in C and other langauges capitalize constants so that you can tell the difference between a constant and a regular variable when you read the code.
Also there are 1,000's of constants just for the Win32 API so I doubt that it would be very practical to put them all in a single program. I do however like your reference program that you wrote it's a nice starting place
Keep up the awesome work your doing Codescript just know that I did not mean for it to sound like I was pointing directly at you... Many people on this forum do this. They post code with @Sendmsg but never tell people the name of the message that they are sending. It's hard to hunt these down when you don't know the name. The code you post here need not be perfect but should be reusable and readable by others. As for the title I reread my previous post and I do understand how you may feel but honestly I was not trying to single just you out. The admins here originally gave me that same title at the same time they gave it to you but I asked them to change that since I don't consider myself a guru at anything and I did not want the responsibility of it My comment was more meant just as a little razz than as a put down. Sorry for the sarcasim _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|