Groups > dBase > dBase shared code > Re: A DatePicker form based on MS Date and Time Picker Control 6.0 (SP4)




Re: A DatePicker form based on MS Date and Time Picker
Control 6.0

Re: A DatePicker form based on MS Date and Time Picker Control 6.0
Fri, 23 Jun 2006 10:27:49 -070
Ivar B. Jessen wrote:
> In a recent thread a custom spinbox control for setting values in a
timestamp field has been
> discussed. That made me take a look at the Activex MS Date and Time Picker
Control  6.0 (SP4).
> 
> I got it to run without GPF's and license errors and it is very easy to set
values, either by typing
> directly into the timestamp field or by using the left/Right arrows for
positioning and the Up/Down
> arrows for changing values.
> 
> The control uses the shortdate string set in control panel -> regional
settings under the selected
> language.
> 
> If your language is English(USA) the timestamp format is MDY with slashes
and AM/PM. Setting the
> language to Spanish(Mexico) will result in the format DMY with slashes and
a.m./p.m.
> 
> 
> Any bugs, comments?

I ran the form "as is", but if I try to go out and find this control
by 
clicking on the classID in the inspector, it does something bad, and the 
control is "not licensed for this machine" ...

Interesting, though.

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: A DatePicker form based on MS Date and Time Picker Control 6.0
Fri, 23 Jun 2006 11:27:16 -070
Ivar B. Jessen wrote:
>>I ran the form "as is",
> 
> 
> Thanks for the confirmation that will run it without errors.
> 
> 
>>but if I try to go out and find this control by 
>>clicking on the classID in the inspector, it does something bad, and the

>>control is "not licensed for this machine" ...
> 
> 
> Don't get it via the classId. Go to the Component Palette  -> ActivX
tab, and drag it to the form in
> the Designer. Remember also to release the ActiveX in the form_canClose
event. Before figuring that
> one out I had an endless row of license errors and GPF's when closing the
form. 

I don't have it set up as a control I can use via the ActiveX tab 
(didn't until I brought your form in the the form designer). You have to 
set those up, you know ... once you use an ActiveX in a form, dBASE 
automatically sets the object on the ActiveX tab of the palette. 
However, I just tried dragging this control to a new form, and get the 
"This control is not licensed for this machine" error ...

> 
> As it is now it appears to be pretty stable.

Can't run it at all on my XP Home machine because the MS Date and Time 
Picker Control is not installed anywhere.

>>Interesting, though.
> 
> 
> Yes, it uses less code than yours :-)

Well sure, because all that code is buried in the object. <g>

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: A DatePicker form based on MS Date and Time Picker Control 6.0
Fri, 23 Jun 2006 16:10:00 -040
"Ivar B. Jessen" wrote:
> 
> >Can't run it at all on my XP Home machine because the MS Date and Time
> >Picker Control is not installed anywhere.
> 
> Doesn't it come with MS Office?

It ran fine the first time, then quit running after I saved the form in
the designer, not licensed for machine error. After checking, I noticed
it stripped out the license property setting that was included in your
original post.

I noted that you cannot tab to the control, or tab out of the control.
Do you have that problem?

-- 
Post Reply
A DatePicker form based on MS Date and Time Picker Control 6.0 (SP4)
Fri, 23 Jun 2006 16:23:48 +020
In a recent thread a custom spinbox control for setting values in a timestamp
field has been
discussed. That made me take a look at the Activex MS Date and Time Picker
Control  6.0 (SP4).

I got it to run without GPF's and license errors and it is very easy to set
values, either by typing
directly into the timestamp field or by using the left/Right arrows for
positioning and the Up/Down
arrows for changing values.

The control uses the shortdate string set in control panel -> regional
settings under the selected
language.

If your language is English(USA) the timestamp format is MDY with slashes and
AM/PM. Setting the
language to Spanish(Mexico) will result in the format DMY with slashes and
a.m./p.m.


Any bugs, comments?


Ivar B. Jessen

//-----
** END HEADER -- do not remove this line
//
// Generated on 23-06-2006
//
parameter bModal
local f
f = new datepickerForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class datepickerForm of FORM
   with (this)
      canClose = class::FORM_CANCLOSE
      onOpen = class::FORM_ONOPEN
      height = 6.4091
      left = 43.2857
      top = 7.8636
      width = 40.0
      text = ""
      mdi = true
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      height = 1.0
      left = 7.0
      top = 1.0
      width = 22.0
      value = ""
   endwith

   this.ACTIVEX1 = new ACTIVEX(this)
   with (this.ACTIVEX1)
      height = 1.5
      left = 7.0
      top = 3.5
      width = 27.0
      license = "651A8940-87C5-11d1-8BE3-0000F8754DA1"
      state =
"DCFEEFCDBJBBBBBBCQCEBBBBQQBDBBBBFCDJIQBPBBBBBHBBDBBBBBBBOHBIBHBBBDBBCFBBBB
BBBBBBBBBBBBBBBQDIBNBBBGBBCQBBBBBBBBBBBBBBBBBBFCBHBCBBBCBBBCBBBBBBBBBBBBBBBBBBCJ
BBBBBBBBBBBBBBBCPQNOLMBBBBBGBBONPCCDBBBHBBNFBBQQQQQQQQQQQQQQQQDFPDCDBBBBBBBBBBCQ
OPPNMOBCBBBGBBPJPCCDBB"
      classId = ""
   endwith

   with (this.ACTIVEX1.nativeObject)
      Change = {;form.entryfield1.value = form.activeX1.nativeObject.value}
   endwith


   function form_canClose
      form.activeX1.release()
      return true

   function form_onOpen
   init()

   local r
   r = form.activeX1.nativeObject

   r.font.Name = "Ariel"
   r.font.size = 10
   r.CalendarBackColor = 0xFFFFCC
   r.CalendarForeColor = 0x0000FF
   r.CalendarTitleBackColor = 0xFFFFCC
   r.CalendarTrailingForeColor = 0xFF8080

   r.format = 3
   r.CustomFormat = getTimeStampString()

   d = new date()
   r.hour = d.getHours()
   r.minute = d.getMinutes()
   r.second = d.getSeconds()
   form.entryfield1.value = r.value
   return

endclass


   function init()

   #define LOCALE_SSHORTDATE           0x0000001F
   #define LOCALE_STIMEFORMAT          0x00001003

   extern culong GetSystemDefaultLCID(cVOID) kernel32
   extern culong GetUserDefaultLCID(cVOID) kernel32
   extern CINT GetLocaleInfoA(CULONG, CULONG, CSTRING , CINT)  kernel32

   return

   function getTimestampString

   lokaleID = GetUserDefaultLCID() 
   bufAdr = replicate(chr(0), 16)
   bufLen = len(bufAdr)

   a = GetLocaleInfoA(lokaleID, LOCALE_SSHORTDATE, bufAdr, bufLen)
   cD =  substr(bufAdr, 1, a-1)

   a = GetLocaleInfoA(lokaleID, LOCALE_STIMEFORMAT, bufAdr, bufLen)
   cT = substr(bufAdr, 1, a-1)
   
   return cD + " " + cT
Post Reply
Re: A DatePicker form based on MS Date and Time Picker Control 6.0 (SP4)
Fri, 23 Jun 2006 19:57:36 +020
On Fri, 23 Jun 2006 10:27:49 -0700, in dbase.shared-code, 
Subject: Re: A DatePicker form based on MS Date and Time Picker Control  6.0
(SP4), 
Message-ID: <jyFhfuulGHA.1972@news-server>,  
"Ken Mayer [dBVIPS]" <dbase@_nospam_goldenstag.net> wrote:


>> Any bugs, comments?
>
>I ran the form "as is",

Thanks for the confirmation that will run it without errors.

>but if I try to go out and find this control by 
>clicking on the classID in the inspector, it does something bad, and the 
>control is "not licensed for this machine" ...

Don't get it via the classId. Go to the Component Palette  -> ActivX tab, and
drag it to the form in
the Designer. Remember also to release the ActiveX in the form_canClose event.
Before figuring that
one out I had an endless row of license errors and GPF's when closing the form.


As it is now it appears to be pretty stable.

>Interesting, though.

Yes, it uses less code than yours :-)


Ivar B. Jessen
Post Reply
<< Previous 1 2 3 Next >>
( Page 1 of 3 )
about | contact