INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Editing a cursor – handling dates

Editing a cursor – handling dates

(OP)
I have a modal form which can be used to browse and edit a cursor. So, the name of the cursor and the column captions are passed across; the cursor might contain three fields, quantity, date and comment. After editing the modified cursor is available to the calling form.

This works fine.

I also have a date/textbox class which allows a date to be edited. It has one property, this.zDate which is indeed a date, but the class itself is of base class textbox. It normally displays as ’27-Dec-17’, but when it has focus and is being edited it displays ’27-11-17’, with an input mask of ‘99-99-99’.

I would like to use this control class as a means of editing any of the fields which are dates, using :

CODE -->

. . .Column1.addobject() . . . .
. . .Column1.curentcontrol = . . .
. . . 

but this is not an immediate success , because of the conflicting data types of the field in the cursor and the new control.

Grateful for helpful suggestions. Thanks, Andrew

RE: Editing a cursor – handling dates

From your description I can only guess how your specific textbox works on strings rather than dates. Well, then you can forget about binding that control the usual way. A class based on textbox still offers the normal controlsource to the grid and the grid makes use of that, overriding all your behaviour and code to act on a zDate string property with the inputmask.

The necessary work to wire this is doable, but now will require you to act on any grid row change not only via AfterRowColChange but also during the rendering of the grid and then within several events like lostfocus and valid. Is it really worth it?
Just the normal date type in conjunction with .DateFormat property offers everything you normally need.

Bye, Olaf.

RE: Editing a cursor – handling dates

(OP)
Thanks Olaf

Yes, I was pretty much coming to the same conclusion. I had been putting code (and breakpoints) into the control's gotfocus(), Lostfocus(), Valid() , zDate_assign() events - also into AfterRowColchange(). But was still finding it difficult to stop the cell in the grid from being blanked out.

RE: Editing a cursor – handling dates

Andrew,

This doesn't answer your question, but remember, if you want to use an input mask with a textbox in a grid, it is the column's InputMask property that must be set, not the textbox's. It might be helpful to keep that in mind.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Editing a cursor – handling dates

Mainly, you'll need to find another way of the textbox to know the origin of the value and what field to finally update than the grid column controlsource. You'll only get somewhere the grid does not get in your way, if you keep the grid off the textbox controlsource mechanism, as that always means the influence of value and thus also displayvalue.

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close