Groups > dBase > dBase shared code > Re: DateTimeSpinbox (vers. 9)




DateTimeSpinbox (vers. 9)

DateTimeSpinbox (vers. 9)
Thu, 22 Jun 2006 06:13:02 -070
Well, I keep hoping the most recent posting will be the last, but ... 
here we go again. Please beat on it ...

Thanks --

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase

Post Reply
Re: DateTimeSpinbox (vers. 9)
Thu, 22 Jun 2006 13:50:35 -070
Ivar B. Jessen wrote:
> On Thu, 22 Jun 2006 06:13:02 -0700, in dbase.shared-code, 
> Subject: DateTimeSpinbox (vers. 9), 
> Message-ID: <oK57b7flGHA.1524@news-server>,  
> "Ken Mayer [dBVIPS]" <dbase@_nospam_goldenstag.net> wrote:
> 
> 
>>Well, I keep hoping the most recent posting will be the last, but ... 
>>here we go again. Please beat on it ...
> 
> 
> When test form opens value in DT-field is 21-12-2003 12:13:14.
> 
> When attempting to type 22 in datefield nothing happens.
> 
> When attempting to type 22 in datefield and finishing by pressing 'Enter'
nothing happens, but now
> try again to type 22 and the new value sticks ;-) that can't be the final
solution, what about a
> version 10.

I can't get that to happen. I did a lot of testing of it before posting ...

> A different issue. Adding the following line:
form.DateTimeSpinbox1.DateFormat = "GERMAN" in the
> form_onOpen results in the following display in the DT-field,
> 
> 21.12.2003 12:13:14
> 
> This is fine and works as describe in the *.cc header.
> 
> When printing out the value of the DT-field using a pushbutton containing
the following lines;
> 
>    function PUSHBUTTON2_onClick
>       form.DateTimeSpinbox1.refresh()
>       ? "DT-field = ", form.DateTimeSpinbox1.DT.toLocaleString()
> 
> the result is,
> 
> 21-12-2003 12:13:14
> 
> This value is not the value of the DT-field, the marks are wrong.

I have no control over what toLocaleString() displays. <g> If the marks 
are wrong, it's not something I have any control over. What happens if 
you type:

set("mark")

In the Command Window?

My change of the mark is temporary, I jumped through hoops so that you 
can use the various formats with the default marks for those formats. 
However, I reset your system when the INIT routine is done, so that if 
you have a custom MARK set, or a different date format (SET DATE ...), I 
have not touched that.

> An oddity. Add the following line in the form_onOpen and loading a null
record into the DT-field
> gives the indicated result,
> 
> form.DateTimeSpinbox1.defaultdate = null // 22-07-2006 00:00:00
> 
> Replace the line with this,
> 
> form.DateTimeSpinbox1.defaultdate = {00-00-0000 00:00:00} // 31-12-1999
00:00:00
> 
> I would have expected the same result in both cases.

Um, hmm. 00-00-0000 is not empty ... I started using if empty( ) as it 
works with a datetime or date object ... and I don't have any code to 
trap an invalid DefaultDate value ... (sigh).

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
Post Reply
Re: DateTimeSpinbox (vers. 9)
Thu, 22 Jun 2006 14:16:43 -070
Ivar B. Jessen wrote:
> On Thu, 22 Jun 2006 06:13:02 -0700, in dbase.shared-code, 
> Subject: DateTimeSpinbox (vers. 9), 
> Message-ID: <oK57b7flGHA.1524@news-server>,  
> "Ken Mayer [dBVIPS]" <dbase@_nospam_goldenstag.net> wrote:
> 
> When test form opens value in DT-field is 21-12-2003 12:13:14.
> 
> When attempting to type 22 in datefield nothing happens.
> 
> When attempting to type 22 in datefield and finishing by pressing 'Enter'
nothing happens, but now
> try again to type 22 and the new value sticks ;-) that can't be the final
solution, what about a
> version 10.

Okay, what you've run into is the way dBASE handles numeric values ... 
what I've done is change the default color to something that makes this 
more obvious. Clicking on the entryfield will remove the "selectAll",

and put the cursor wherever you clicked, which may make it hard to type 
over the number. I tried forcing a selectAll in the onGotFocus, but 
can't find the right keyboard() combinations to make it work ... sigh.

Anyway, the color change should be more obvious.

> An oddity. Add the following line in the form_onOpen and loading a null
record into the DT-field
> gives the indicated result,
> 
> form.DateTimeSpinbox1.defaultdate = null // 22-07-2006 00:00:00
> 
> Replace the line with this,
> 
> form.DateTimeSpinbox1.defaultdate = {00-00-0000 00:00:00} // 31-12-1999
00:00:00
> 
> I would have expected the same result in both cases.

I have it checking the DefaultDate to see if it's empty. If it is, it 
uses the current date ... see vers. 10 ...

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
Post Reply
Re: DateTimeSpinbox (vers. 9)
Thu, 22 Jun 2006 22:29:33 +020
On Thu, 22 Jun 2006 06:13:02 -0700, in dbase.shared-code, 
Subject: DateTimeSpinbox (vers. 9), 
Message-ID: <oK57b7flGHA.1524@news-server>,  
"Ken Mayer [dBVIPS]" <dbase@_nospam_goldenstag.net> wrote:

>Well, I keep hoping the most recent posting will be the last, but ... 
>here we go again. Please beat on it ...

When test form opens value in DT-field is 21-12-2003 12:13:14.

When attempting to type 22 in datefield nothing happens.

When attempting to type 22 in datefield and finishing by pressing 'Enter'
nothing happens, but now
try again to type 22 and the new value sticks ;-) that can't be the final
solution, what about a
version 10.

A different issue. Adding the following line: form.DateTimeSpinbox1.DateFormat =
"GERMAN" in the
form_onOpen results in the following display in the DT-field,

21.12.2003 12:13:14

This is fine and works as describe in the *.cc header.

When printing out the value of the DT-field using a pushbutton containing the
following lines;

   function PUSHBUTTON2_onClick
      form.DateTimeSpinbox1.refresh()
      ? "DT-field = ", form.DateTimeSpinbox1.DT.toLocaleString()

the result is,

21-12-2003 12:13:14

This value is not the value of the DT-field, the marks are wrong.


An oddity. Add the following line in the form_onOpen and loading a null record
into the DT-field
gives the indicated result,

form.DateTimeSpinbox1.defaultdate = null // 22-07-2006 00:00:00

Replace the line with this,

form.DateTimeSpinbox1.defaultdate = {00-00-0000 00:00:00} // 31-12-1999
00:00:00

I would have expected the same result in both cases.


Post Reply
Re: DateTimeSpinbox (vers. 9)
Fri, 23 Jun 2006 09:13:33 -070
Ivar B. Jessen wrote:


> I don't really understand why you have included options like,
> 
> form.DateTimeSpinbox1.DateFormat = "GERMAN"
> 
> In this case the DT-field displays the mark as ".", but when the
value of the DT-field is used in an
> entryfield or in a table the mark will always be displayed as
"-", so what is the purpose served by
> the option? Or have I misunderstood something here?

Flexibility. A developer may want to control the display on the form.
>>Um, hmm. 00-00-0000 is not empty ... 
> 
> 
> ? empty({00-00-0000 00:00:00}) // true

Yeah, so I found out after I posted this. I wasn't testing for an empty 
default date ...

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact