Sytze,
Did the solution below sort out your problem?

Dave

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Dave Crozier
Sent: 21 June 2013 11:34
To: ProFox Email List
Subject: RE: Date in Grid

Sytze,
Sorry not to come back to you but the email server went down yesterday. However 
after a little thought this works:

Remove the coding in the last column Valid and instead put into the Keypress 
event the following:

LPARAMETERS nKeyCode, nShiftAltCtrl

If lastkey()=13
        nodefault
        keyboard '{DnArrow}{leftArrow}'
endif
*
return

Hope this helps...

Dave

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Sytze de Boer
Sent: 19 June 2013 21:26
To: profox
Subject: Re: Date in Grid

Hello Dave
I was about to give up on this, but it seems you are determined to help me, so 
I owe you feedback.
The suggested method seems to work on the first row, but not subsequent rows.
i.e.
(where the first column is the date)
On entering the grid, i see the date requires me to enter the day (only).
So far so good
I enter data into other columns
I get to the last column which has a valid If lastkey()=13, keyboard '{DNARROW}'
So I'm back in column 1, 2nd row.
I enter another day and we're back to default behaviour, invalid date, because 
the rest of the date is blanked.
I wonder if its to do with SelectOnEntry or Insert on/off




On Wed, Jun 19, 2013 at 8:16 PM, Dave Crozier <[email protected]> wrote:

> Sytze,
> My example assumes dates are in the format DD/MM/YYYY and just as an 
> aside, if you enter the field inadvertently and find you DON'T really 
> want to change the day, simply hit the escape key which will restore 
> the date to its original value.
>
> Hope it helps.
>
> Dave
>
> -----Original Message-----
> From: ProFox [mailto:[email protected]] On Behalf Of Dave 
> Crozier
> Sent: 19 June 2013 08:36
> To: ProFox Email List
> Subject: RE: Date in Grid
>
> Sytze,
> Sorry, didn't read the fact that you are in a grid.
>
> In that case, once again in the Gotfocus() event:
>
> * Set the date that you want to override the day of dDate = Date()
>
> if This.Value=dDate
> *       This.SelStart = 0
> *       This.SelLength = 2
>         cMonthYear = Substr(Dtos(dDate),5,2)+Substr(Dtos(dDate),1,4)
>         cKeys = "{Home}{Del}{Del}"
>
>         keyboard cKeys
>
> endif
> *
> return
>
> -----Original Message-----
> From: ProFox [mailto:[email protected]] On Behalf Of Sytze de 
> Boer
> Sent: 18 June 2013 21:15
> To: profox
> Subject: Re: Date in Grid
>
> Dave, as always, really appreciate your help However, this code made 
> zero difference When I "enter" the form/grid, all dates are 
> pre-populated  with today's date It is when they want to over ride the 
> date (say from 19/6/2013 to 23/6/2013), thats when I want to just 
> enter the 23, and the rest should follow (month and year)
>
>
>
>
> On Tue, Jun 18, 2013 at 7:09 PM, Dave Crozier <[email protected]>
> wrote:
>
> > Sytze,
> > In the Date TextField put the following in the Gotfocus() Event
> >
> > if Empty(This.Value)
> >         This.Value = Date()
> >         keyboard "{backspace}"
> >
> >         This.SelStart = 0
> >         This.SelLength = 2
> >
> > endif
> >
> >
> > That should do what you want.
> >
> > Dave
> >
> >
> > -----Original Message-----
> > From: ProFox [mailto:[email protected]] On Behalf Of Sytze de 
> > Boer
> > Sent: 18 June 2013 03:24
> > To: profox
> > Subject: Date in Grid
> >
> > In this instance, I use a grid to enter data, 1 column of which is a 
> > Date field The date fields defaults to today If the user enters 15 
> > and presses enter, it ends up with "invalid date"
> > If the user enters 1504  (where the slash is automatic), the system 
> > auto adds the year
> >
> > I want it to auto enter the current month and year Possible ?
> >
> > --
> > Kind regards
> > Sytze de Boer
> > Kiss Software
> >
> >
> > --- StripMime Report -- processed MIME parts --- multipart/alternative
> >   text/plain (text body -- kept)
> >   text/html
> > ---
> >
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to