December 12th, 2013, 07:26 AM
Delphi system has changed with Windows7
Hello, I'm hoping this will be a fairly easy fix........
I have a system that needs negative numbers put in the fields. We were using Windows XP and all was well. Now, we all received new computers that have Windows7 operating system and the users are complaining that when they put in a negative number, the minus sign goes to the back of the number instead of the front. This is so weird and I can't understand why it's happening. If anyone could shed some light on this I would be very grateful!!
Thanks in advance!
December 12th, 2013, 08:31 AM
Hi, sounds like regional settings. This can be amended from Control Panel -> Regional Settings in Windows. If its not this, then perhaps the component you are using for number input has some "mask" set on it - check its properties.
Also google for
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, P);
The above set the decimal separator, perhaps you can use it to set that display format automatically instead of setting regional settings for each computer.
December 12th, 2013, 09:10 AM
Thank you for your response! I tried changing the regional settings but that didn't work. I wasn't even aware of those settings until you told me. I'm changing the field's properties to "True" for the ParentBidiMode under Localizable. That changed the minus sign to the front of the number now but as soon as i tab away, the whole number aligns to the left instead of the right. I'm looking for a way to change that now.
December 12th, 2013, 09:20 AM
Which delphi components are you using on the form? (for the numbers)
December 12th, 2013, 09:22 AM
I'm using the TMaskEdit in Delphi 2007. The other thing i don't understand is that a couple of users are not having any problems at all but myself and a few others are??
December 12th, 2013, 09:25 AM
Incase we didnt look at the same page. Its under Region -> Additional Settings -> negative Number Format
Also make sure you are running your application under the same user for which you changed the regional settings (ie. not running the app as admin whilst changing the settings for a local user). I vaguely remember this may be having an effect.
December 12th, 2013, 09:27 AM
Ok, perhaps the regional settings wont have an effect if you're using the TMaskEdit. What does your mask format look like?
December 12th, 2013, 09:30 AM
The regional settings look the same but I will check what user it is running under. I have to leave work today at 10:30 but I will work on this tomorrow and let you know. Thanks!!
December 13th, 2013, 08:58 AM
The regional settings look like yours but how do i check what my app is running under? I'm not sure how to do that. Also, I didn't give my TMaskEdit any formatting. I changed the ParentBidiMode property to true which fixed the minus sign problem but the BiDiMode automatically changes to bdLeftToRight when i want it to be right to left.
December 13th, 2013, 12:31 PM
bdiMode seems to be specifically for left to right / right to left.
ParentBdiMode simply makes your control use the value of the bdiMode of the form / containers it's been placed on.
Assuming you havent set the app to run as admin, just ensure that yuo arent running your delphi as Admin. If so your app will runb as admin (and not the current user). Just something to consider. But I doubt this would be the case / have an effect, the Currency setup wouldn't effect a Maskedit, so far as I can see.
Ill keep thinking. Dont have any ideas just now - besides using a mask #99999999.99;1;_ (or similar) - but then it might not be perfect. Or using keypress events on a normal TEdit. Apologies for the lack of useful info :-)
December 13th, 2013, 12:48 PM
You're doing great! Any info is useful info. Thank you! I will play around with this TMaskEdit some more and let you know the outcome. Right now, I am looking into this UseRightToLeftAlignment function.
December 15th, 2013, 06:06 AM
I assume you are using these components for numerical input. If so, you could consider looking at JEDI components (they have a whole batch of nice components including numerical edits). Also, its open source / free.
If you don't want the whole library, i have attached a very simple attempt at a quick 5 minute numedit. Its in a package, just compile and install. You can change the source to suit your needs. It allows for maxlength, decimalplaces and allows only numbers and fullstop (for decimals). It doenst take into account system locale.
December 16th, 2013, 08:03 AM
Thanks for the info! I can't get into the site though. We are not permitted for some reason.
December 18th, 2013, 08:23 AM
Well, I didn't get fancy but i made a fix......just to keep you posted. I changed the ParentBidiMode to "true" under Localizable which fixed the minus sign problem and then I used this code to somewhat help the appearance of the numbers in the TMaskEdit:
For MskEdCnt:= 0 to ComponentCount - 1 do
If Components [MskEdCnt] is TMaskEdit then
TMaskEdit (Components[MskEdCnt]).Text := ' 0.00';
This isn't the best fix but I also wanted to keep 0.00 in each field when the screen first pops up. The user said it really didn't matter if it right aligned or not.
But now they can't print. I have to research that. The system was created in Delphi 2006 but when we got our new computers i couldn't get 2006 to work right so I installed 2007. Delphi2007 doesn't use RvProject component to print. I need to look for a replacement. Getting our new computers is what started all of this mess. Lol!
Thank you for all of your help though!!
December 18th, 2013, 08:31 AM
btw, accidentally came across this.
If you're not looking for freeware specifically, I would recommend Fast Reports VCL, however what's below looks promising. Its the same guys, but with a freeware version. (less functionality but an option)