Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTPicker Control 2

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,814
JP
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]
 
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:

[tt]this.object.Enabled = thisform.Editing[/tt]

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

RCSDateTimePicker mentioned in Just the first three google results for me...

Bye. Olaf.

Olaf Doschke Software Engineering
 
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
 
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]
 
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
 
Instead of Createobject(), you can use NewObject() which allows you to specify the class library.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top