Page 1 of 1

@K in picture clause and enter of ".", decimal point first

Posted: Mon Jun 27, 2011 11:16 am
by Cliff Wiernik
Say you have code like this.

a := 100.00
@ 1,1 DCGET a PICTURE '@K 999.99'

In clipper, if any key is entered other than cursor keys, the field is cleared out prior to accepting the entered characters.

However in Xbase++/Express++, it works slightly differently. If the user enters .50, the field becomes 100.50, versus .50 for clipper. If they enter 0.50, the 0 causes the field to be first cleared and then the rest of the data is taken, resulting in 0.50.

Is this how it is supposed to work with Xbase++/Express++ and if so, is it possible to get a configurable get/set option that allows it to be one way or the other. I just ran across this today during some testing and a user commented on its behavior of a module finally moved from clipper to windows.

Cliff.

Re: @K in picture clause and enter of ".", decimal point first

Posted: Mon Jun 27, 2011 11:24 am
by rdonnay
Cliff -

It's been working this way a long time.
I want to be careful not to break anything to give you the behavior you want, but I will look into it.

Roger

Re: @K in picture clause and enter of ".", decimal point first

Posted: Tue Jun 28, 2011 1:10 am
by Markus Walter
Hi Cliff,

i found this problem years ago, but Roger didn't want to change this...

My solution was to mark the get in the SetInputfocus-Slot

Code: Select all

if valtype(o:getdata()) == "N"
    o:setMarked( {1, o:bufferLength+1 } )
endif
With this, you have a nearly equal behavior like in clipper.

Re: @K in picture clause and enter of ".", decimal point first

Posted: Tue Jun 28, 2011 9:43 am
by Cliff Wiernik
I know it has been working this way a long time. Never really noticed it. The user did because in payables, they have a vendor with alot of < 1.00 distributions. That is why, if it could be done, it would be via something like Markus suggested, but via a get/set function so you do not break existing behavior. Just a thought. Or the user has to get used to typing in 0.16 instead of .16 for the process. It is just that they are still using the clipper app for the last few remaining options so they trained on clipper behavior.

I will experiment with Markus's suggestion.