×
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!
  • Students Click Here

*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.

Students Click Here

Jobs

DTPicker Control
2

DTPicker Control

DTPicker Control

(OP)
Hi All,
I have been experimenting with the DTPicker control and found a couple of oddities that hope can be sorted.
The two issues are:
1) The control appears in the form as a 3D-Chiseled look (which in modern applications is no longer the "norm"). Is it possible to show the control as flat, like other VFP controls?

2) I noticed there is a .Enabled property, but when I try to control the objects availability in the objects refresh clause with:
This.Enabled = ThisForm.Editing

The control never changes its enabled state. It seems to always be enabled no matter what. Is there some trick to disabling it?

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: DTPicker Control

Scott, there is an even more serious issue with the DTPicker that you didn't mention: it doesn't support blank or null dates (blank dates are a bit of a VFP speciality).

To enable or disable the control, you need to do this:

this.object.Enabled = thisform.Editing

Regarding the appearance of the control, as far as I know there is nothing you can do about that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: DTPicker Control

(OP)
Hi Mike,
I read about that in some other posts, but I couldn't find any way to address those other two points I mentioned.
What I decided to do to avoid those issues is, I don't use DTPicker as a control for displaying the value, only as a means of selecting a date, and that is then passed to a standard textbox control, so the textbox keeps all that. I did this by setting the UpDown property to false (making it a dropdown), then I made the size of the control 24 x 24, which only shows the "dropdown" graphic. I put that next to the textbox that it controls and then in its Change event I put in the following:

CODE

cDate = "{^"+ALLTRIM(STR(This.Year))+"/"+ALLTRIM(STR(This.Month))+"/"+ALLTRIM(STR(This.Day))+"}"
dDate = &cDate
*
This.Parent.txtExpenseDate.Value = dDate 

So it avoids all those issues about null dates, blank dates, etc.

But I'm still looking for ways to solve the Enabled and 3D look issues.

Thanks for the tip on Enabling. I made that change and it's working fine. If there is no "fix" to the appearance, that's not a huge show stopper, as it doesn't look too odd, since I've minimized the "visibility" down to just the button that causes the calendar to pop up. It already has a different look there in the solid triangle as opposed to VFP dropdowns which have a small v character in them, both of which are on this form. So there are other visual issues that annoy me about it, but I can't change either of them so they would all match.


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: DTPicker Control

You're misunderstanding mike, the capability of having NULL or the empty data is something VFP has on top of a concrete date. Doesn't matter much.

Besides that, you're having a much easier was to turn the three date parts into a VFP date: DATE(This.Year, This.Month, This.Day), also see https://www.foxite.com/archives/date-picker-contro...

And otherwise: There really are no vectors to change the look and even just coloring, use something else instead of the DTPicker, there are several alternatives.

http://fox.wikis.com/wc.dll?Wiki~ImprovedDate/Date...
https://www.levelextreme.com/ShowHeaderDownloadOne...
RCSDateTimePicker mentioned in http://doughennig.com/papers/Pub/CoolControls.pdf
Just the first three google results for me...

Bye. Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: DTPicker Control

As Olaf aays, there are several alternative date pickers that don't suffer from the same issues as the DTPicker. Ideally, find one that's implemented using native Fox controls. In my case, I wrote my own, which wasn't all that difficult. Scott, I'm sure you are very capable of doing the same.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: DTPicker Control

(OP)
Thanks guys. I was trying to avoid making one from scratch, mostly because I'm pressed for time at the moment. I had been look for a "native" date calendar selector for a while, and just stumbled across the DTPicker in another thread here while looking for a solution to something else, and thought I'd give it a try.

Olaf, thanks for the simplification on the Date, my complicated way of doing it is now updated with:

dDate = DATE(This.Year, This.Month, This.Day)

Much cleaner.

I just tried the RCSControl mentioned in the Doug Hennig article. But I've run into a problem, I've not seen before.
I added the RCSCalendar.VCX to my project, I can see all the classes in it. I put the DateTimePicker control on the form, bound the source control to expenseenddate. It displays fine, but when I click the down arrow to get the calendar, I get the error "Class definition RCSCALENDARFORM is not found." And the offending call is: This.oCalendar = CREATEOBJECT("rcsCalendarForm")

Which I don't understand. The class library is in the project, the class is in the CLASSES directory where all the other class libraries are. I couldn't find anything in the mention of the article that I need to do (other than add the images to the project, which I've already done, and that's not related to this error.)

Any idea what I'm missing?

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: DTPicker Control

Scott,

I don't know this control, so this is probably not much help, but you might also need to SET CLASSLIB to the VCX holding the class (assuming it is in a VCX).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: DTPicker Control

As Mike says, to be able to use a simple CREATEOBJECT("classname") VFP needs SET CLASSLIB to point to VCXes, it's not enough to SET PATH to the folder of all VCX, so you sure have a section of SET CLASSLIB already or you always work with NeObject(), where you sepcify class and classlib and even more parameters.

The problem also vanishes once you run an EXE, the runtime always finds classes embedded in an EXE.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: DTPicker Control

Instead of Createobject(), you can use NewObject() which allows you to specify the class library.

RE: DTPicker Control

Scott,

Just to add to other suggestions, you may consider to take a look at the CalendarCalc project @ VFPX. It incorporates a DatePicker that you can add to your forms (there is a sample form that you can run just by DOing it). It's open source, VFP code, and UNLICENSEd.

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!

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