View previous topic :: View next topic |
Author |
Message |
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu May 08, 2003 9:50 pm Post subject: SPIN Element Bugs |
|
|
Here's the first bug: when a value such as 9999999999 is inputted then
it will incorrectly display and read it.
Code: | Title Spin Bug
DIALOG CREATE,Spin Bug,-1,0,340,160
DIALOG ADD,SPIN,SPIN1,71,34,227,24
DIALOG SHOW
DIALOG SET,SPIN1,9999999999
:Evloop
wait event
goto @event()
:Close
exit |
Also when using the NOEDIT style, the user can still delete numbers using
the DEL key.
VDS 5 will probably fix that though. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Fri May 09, 2003 10:18 am Post subject: |
|
|
you're right ff...not good
could someone beta testing vds5 perhaps test it to see if these 2 bugs are still there...
Serge _________________
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri May 09, 2003 1:11 pm Post subject: |
|
|
That is not a bug guys it is a limitation not in VDS but rather the Win32 API.
That number is too big to fit in a LONG or Integer variable type so the spin element rolls it over to a negative number which happens to be the lower value of the SHORT variable type. There is no such thing as a unlimited numeric variable type. VDS is prob. using the up/down common control. Which means that VDS is sending the control API messages to set the range. Both the wparam and lparam are LONG or Integer variable types which mean that the number has to be in this range -2147483648 … 2147483647
Any number greater than or less than these numbers will cause it to roll over the size of a short or WORD variable type... Below is the Win32 API information for up/down controls (ie...VDS spin element).
Quote: | UDM_SETRANGE
wParam = 0;
lParam = (LPARAM) MAKELONG((short) nUpper, (short) nLower);
The UDM_SETRANGE message sets the minimum and maximum positions (range) for an up-down control.
Parameters
nUpper and nLower
Maximum position and minimum position for the up-down control. Neither position can be greater than the UD_MAXVAL value or less than the UD_MINVAL value. In addition, the difference between the two positions cannot exceed UD_MAXVAL.
Return Value
No return value.
Remarks
The maximum position can be less than the minimum position. Clicking the up arrow moves the current position closer to the maximum position, and clicking the down arrow moves towards the minimum position. |
Below is how Microsoft defines UD_MAXVAL and UD_MINVAL...
Quote: | #define UD_MAXVAL 32767
#define UD_MINVAL (-32767) |
So in all honesty you really should not go beyond UD_MAXVAL and UD_MINVAL but because of math as in the fact that the makelong macro converts the two shorts into a long the up/down control (ie...VDS spin element) can go as large as a long.... _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Fri May 09, 2003 10:00 pm Post subject: |
|
|
wow...are you knowledgeable...
i understand about the limitation on the highest number that we can use...interestingly enough, i wrote a program for school that test whether a number is prime or not and i can test up to 14 digit numbers...how come the spin element can only cope with less than 9 digit numbers?
what about the delete "bug"?
Serge _________________
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri May 09, 2003 10:51 pm Post subject: |
|
|
Serge wrote: | wow...are you knowledgeable...
i understand about the limitation on the highest number that we can use...interestingly enough, i wrote a program for school that test whether a number is prime or not and i can test up to 14 digit numbers...how come the spin element can only cope with less than 9 digit numbers?
what about the delete "bug"?
Serge |
Serge,
Correct me if I am wrong here you are using VDS'es floating point math functions? A floating point math function in VDS can handle floating point numbers up to 15 decimal places. There is a difference between the size of a Float and the size of a Long variable type. VDS'es floating point functions use the Double Float variable type this takes (ie... 8 bytes of memory) that is why they are able to handle numbers so large and so small.
The Spin element cannot use floating point numbers. It can only use a Long/Integer number. Different parts of the Win32 API handle numbers differently. This way the Win32 API can be compatible with older software and still give you some new features. Most of the Win32 API has not really been updated since Windows 3.x while other parts have. The real limitation is in the Win32 API function SendMessage. That function's WPARAM and LPARAM parameters can only take numeric variables the size of a Long or Integer. In Win32 the size of a long and the size of a Integer are defined as the same. They both take 4 bytes of memory. If you do the math you will find that the largest whole number and the smallest negative number range that you can place in 4 bytes of memory is the same as a Long variable type. Just a quick note here about the difference between Long's and DWORD numeric types. A DWORD is the 2 complement of a Long, Such that a DWORD's smallest number is 0 and it's largest number is twice that of a Long (ie...4294967296). All these numbers are aprox. and depend heavily on the compiler and what options you set. Some compilers can re-aline the variable types so that they all take up the same amount of memory. Now you can get a bigger whole number but that would require the use of a 64bit(ie...8byte) Integer variable which has the range of -9223372036854775808 … 9223372036854775807 but that is alot of overhead for VDS to work with in it's current release.
Anyway this is not VDS'es fault. You can send an email to Mr. Gates and ask him why the limitation's are in the Win32 API if you like Just kidding... I have seen Spin elements as ActiveX controls that can go higher but they were not as stable as the one that comes with Windows.
Ok I am not really sure here how you mean about the delete bug and the NOEDIT style. This could actually be a bug... Lets just say that there is no actual style at the Win32 level for the Spin control to turn off editing other than disabling it. VDS is prob sub-classing the control and ignoring keystrokes coming from the keyboard and they missed that one or they could have just sent the REadonly message to the Editbox portion of the Spin control. I don't work for SADE so I really do not know how they are applying this style to the element. I am only guessing here and thinking how I would have handled it _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Fri May 09, 2003 11:12 pm Post subject: |
|
|
ok...i understand now about the difference between floating point maths and the maths restriction on the spin element...thanks for that
the delete "bug" i mean is the one ff brought to our attention where even by setting a noedit restriction on the spin element, you can still use delete to delete numbers in the spinbox...is that a normal thing?...perhaps it is normal in the sense that it is a quick way to reach lower numbers compared to using the down arrow...
serge _________________
|
|
Back to top |
|
|
Scheben Newbie
Joined: 09 Apr 2002 Posts: 9 Location: Stuttgart,Germany
|
Posted: Sat May 10, 2003 10:01 pm Post subject: |
|
|
Is it a Bug: i cant use commas in spin styles such as "1,5" or "0.7"!?? |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat May 10, 2003 11:50 pm Post subject: |
|
|
hi Scheben,
the spin element only works with whole numbers such as 1, 2, 3, ... and not with decimals as there is no way of specifiying by how much the number should go up by when clicking on the up arrow
the help file states that only integers can be used as values, and integers are whole numbers
Quote: | The <value> is a valid integer number.
Copyright © 1995 - 2002 S.A.D.E. s.a.r.l. / All rights are reserved. |
so, to answer your question, it is not a bug...but it is a restriction
Serge _________________
|
|
Back to top |
|
|
Scheben Newbie
Joined: 09 Apr 2002 Posts: 9 Location: Stuttgart,Germany
|
Posted: Sun May 11, 2003 10:20 am Post subject: |
|
|
thx Serge, i probably should read the help file more exactly |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sun May 11, 2003 10:37 am Post subject: |
|
|
no probs
Serge _________________
|
|
Back to top |
|
|
|