For Programmers: Free Programming Magazines  


Home > Archive > Visual FoxPro Programming > June 2006 > Date and Time picker control?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Date and Time picker control?
Linn Kubler

2006-06-28, 7:07 pm

Hi,

I'm running VFP 9.0sp1 and in a container class I'm building I added the
Microsoft Date and Time Picker Control 6.0(sp4) control. I put a command
button in the container also and put the following in the click() event.

=MESSAGEBOX(DTOC(this.Parent.dtpicker.Value))

When I put the container class on a form and run the form I can select the
date/time picker and select a date. But when I click the command button
mentioned above I get an error message:
Property VALUE not found.

I don't get it, when I typed the code in the click() event I picked each of
the object and property from the list that appeared after entering each
period. So I picked Parent and I picked dtpicker and I then picked Value
from the lists. So the class designer found the property but the running
program cannot. Can anyone explain where I went wrong? Am I totally
missunderstanding this component? Could there be something wrong with my
system?

The two things that have change recently on my system are that I ran Windows
updates the other day and I install Office 2003 Standard and ran Office
update and applied all updates. Is it possible that the Office install or
updates clobbered mscomct2.ocx or something?

Thanks in advance,
Linn


Dan Freeman

2006-06-28, 7:07 pm

You're not missing anything, but you're asking for the value of the Foxpro
OLE-container on your form. I think you're looking for the value of the OLE
control inside the Fox OLE container. <s>

Try This.Parent.dtpicker.Object.Value

Dan


Linn Kubler wrote:
> Hi,
>
> I'm running VFP 9.0sp1 and in a container class I'm building I added
> the Microsoft Date and Time Picker Control 6.0(sp4) control. I put a
> command button in the container also and put the following in the
> click() event.
>
> =MESSAGEBOX(DTOC(this.Parent.dtpicker.Value))
>
> When I put the container class on a form and run the form I can
> select the date/time picker and select a date. But when I click the
> command button mentioned above I get an error message:
> Property VALUE not found.
>
> I don't get it, when I typed the code in the click() event I picked
> each of the object and property from the list that appeared after
> entering each period. So I picked Parent and I picked dtpicker and I
> then picked Value from the lists. So the class designer found the
> property but the running program cannot. Can anyone explain where I
> went wrong? Am I totally missunderstanding this component? Could
> there be something wrong with my system?
>
> The two things that have change recently on my system are that I ran
> Windows updates the other day and I install Office 2003 Standard and
> ran Office update and applied all updates. Is it possible that the
> Office install or updates clobbered mscomct2.ocx or something?
>
> Thanks in advance,
> Linn



Linn Kubler

2006-06-28, 7:07 pm


"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OAzZgavmGHA.3632@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I'm running VFP 9.0sp1 and in a container class I'm building I added the
> Microsoft Date and Time Picker Control 6.0(sp4) control. I put a command
> button in the container also and put the following in the click() event.
>
> =MESSAGEBOX(DTOC(this.Parent.dtpicker.Value))
>
> When I put the container class on a form and run the form I can select the
> date/time picker and select a date. But when I click the command button
> mentioned above I get an error message:
> Property VALUE not found.
>
> I don't get it, when I typed the code in the click() event I picked each
> of the object and property from the list that appeared after entering each
> period. So I picked Parent and I picked dtpicker and I then picked Value
> from the lists. So the class designer found the property but the running
> program cannot. Can anyone explain where I went wrong? Am I totally
> missunderstanding this component? Could there be something wrong with my
> system?
>
> The two things that have change recently on my system are that I ran
> Windows updates the other day and I install Office 2003 Standard and ran
> Office update and applied all updates. Is it possible that the Office
> install or updates clobbered mscomct2.ocx or something?
>
> Thanks in advance,
> Linn
>


Just noticed another oddity, I'm making the container class initially
invisible, however, the date/time picker stays visible. Even when I change
the container's visible property on and off, it always stays visible even
though the other objects in that container do not. Could this be a symptom
of some kind of corruption in the class?

Thanks,
Linn


Linn Kubler

2006-06-28, 7:07 pm

Dan,
Thanks for the prompt response. I beg to differ though, the name of the
container on the form is called Unbilled, the date/time picker in the
container is dtpicker and the command button is also in the container
Unbilled at the same level as the date picker. The syntax you suggest
implies that the date picker activex object is a container, is that correct?

Thanks,
Linn

"Dan Freeman" <spam@microsoft.com> wrote in message
news:estD0ivmGHA.4700@TK2MSFTNGP03.phx.gbl...
> You're not missing anything, but you're asking for the value of the Foxpro
> OLE-container on your form. I think you're looking for the value of the
> OLE
> control inside the Fox OLE container. <s>
>
> Try This.Parent.dtpicker.Object.Value
>
> Dan
>
>
> Linn Kubler wrote:
>
>



Dan Freeman

2006-06-28, 7:07 pm

Yes, all activex controls live inside a VFP OLEcontrol, which is a form of
container itself.

To directly query the Activex control inside the VFP olecontrol, you need
the object keyword.

Dan

Linn Kubler wrote:[color=darkred]
> Dan,
> Thanks for the prompt response. I beg to differ though, the name of
> the container on the form is called Unbilled, the date/time picker in
> the container is dtpicker and the command button is also in the
> container Unbilled at the same level as the date picker. The syntax
> you suggest implies that the date picker activex object is a
> container, is that correct?
>
> Thanks,
> Linn
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:estD0ivmGHA.4700@TK2MSFTNGP03.phx.gbl...


Imaginecorp

2006-06-28, 7:07 pm

This may be a silly question, but how did you put the DT Picker and button
in the container?. Did you EDIT the Container then put these in? I am
wondering if the container class you created is actually 3 objects
independent of each other
It just seems like these are Not contained IN the Container as when you put
it in the form, it works, when you make the container invisible they stay
visible. Recreate the Container and make sure these are IN the container by
clicking Edit then inserting these 2 controls.
Mohammed


"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OswPxkvmGHA.492@TK2MSFTNGP05.phx.gbl...
>
> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
> news:OAzZgavmGHA.3632@TK2MSFTNGP03.phx.gbl...
>
> Just noticed another oddity, I'm making the container class initially
> invisible, however, the date/time picker stays visible. Even when I
> change the container's visible property on and off, it always stays
> visible even though the other objects in that container do not. Could
> this be a symptom of some kind of corruption in the class?
>
> Thanks,
> Linn
>



Fred Taylor

2006-06-28, 10:03 pm

No, ACTIVEX components do not respect the Visibility of VFP containers.
You'll have to also change their .Visible property when you change the
container's.

--
Fred
Microsoft Visual FoxPro MVP


"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OswPxkvmGHA.492@TK2MSFTNGP05.phx.gbl...
>
> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
> news:OAzZgavmGHA.3632@TK2MSFTNGP03.phx.gbl...
>
> Just noticed another oddity, I'm making the container class initially
> invisible, however, the date/time picker stays visible. Even when I
> change the container's visible property on and off, it always stays
> visible even though the other objects in that container do not. Could
> this be a symptom of some kind of corruption in the class?
>
> Thanks,
> Linn
>



Jack Jackson

2006-06-29, 4:11 am

On Wed, 28 Jun 2006 19:40:38 -0700, "Fred Taylor"
<ftaylor@mvps.org!REMOVE> wrote:

>No, ACTIVEX components do not respect the Visibility of VFP containers.
>You'll have to also change their .Visible property when you change the
>container's.


For that reason I usually create a class based on my framework
container that incudes the ActiveX control. My framework has a method
call in each object to enable/disable and make visible/invisible. I
modify those methods in the container to make the ActiveX control do
the right thing.
Linn Kubler

2006-06-29, 8:03 am

This container is a class I designed using the class designer. I simply
used the tool bar to put the objects in the container like I do when using
the form designer. They seem to be accessable via code, with the exception
I noted, via the object hierarchy I'd expect. So I'm pretty sure the are
"in" the container otherwise my class wouldn't work at all.

Thanks for the suggestion,
Linn

"Imaginecorp" <imaginecorp@msn.com> wrote in message
news:eTfBCmwmGHA.2280@TK2MSFTNGP03.phx.gbl...
> This may be a silly question, but how did you put the DT Picker and button
> in the container?. Did you EDIT the Container then put these in? I am
> wondering if the container class you created is actually 3 objects
> independent of each other
> It just seems like these are Not contained IN the Container as when you
> put it in the form, it works, when you make the container invisible they
> stay visible. Recreate the Container and make sure these are IN the
> container by clicking Edit then inserting these 2 controls.
> Mohammed
>
>
> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
> news:OswPxkvmGHA.492@TK2MSFTNGP05.phx.gbl...
>
>



Fred Taylor

2006-06-29, 7:08 pm

You should be able to use _Assign method to control the ActiveX .Visible.

*YourContainer.visible_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
THIS.Visible = m.vNewVal
LOCAL x
FOR x=1 TO this.ControlCount
this.Controls[x].Visible = this.Visible
ENDFOR

--
Fred
Microsoft Visual FoxPro MVP


"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
news:kas6a2lih5ibnuh3vdhg6k6bvobf246smj@
4ax.com...
> On Wed, 28 Jun 2006 19:40:38 -0700, "Fred Taylor"
> <ftaylor@mvps.org!REMOVE> wrote:
>
>
> For that reason I usually create a class based on my framework
> container that incudes the ActiveX control. My framework has a method
> call in each object to enable/disable and make visible/invisible. I
> modify those methods in the container to make the ActiveX control do
> the right thing.



Linn Kubler

2006-06-29, 7:08 pm

Oh, I see. Didn't know that and haven't had to use it before, like with the
treeview control. But I included it and it works now, thanks!
Linn
"Dan Freeman" <spam@microsoft.com> wrote in message
news:uYRRvEwmGHA.3980@TK2MSFTNGP02.phx.gbl...
> Yes, all activex controls live inside a VFP OLEcontrol, which is a form of
> container itself.
>
> To directly query the Activex control inside the VFP olecontrol, you need
> the object keyword.
>
> Dan
>
> Linn Kubler wrote:
>
>



Linn Kubler

2006-06-29, 7:08 pm

I've not yet delved into the Assign and Access methods in VFP. I gave this
a try...
In the class designer I edited the methods and properties and turned on the
Assign method of the Visible property.
I added a line of code to control the Visible property of the date picker
control.
Then in my program I simply changed the Visible property of the class, like
this:
thisform.myclass.visible = .T.

Looks like it works fine, I' assuming that once the Assign method is created
any change made to the property is routed through there. I had created a
custom method called SetVisible and did the same thing but with using the
Assign method I don't have to worry about remembering special custom method
names. I just use the property as I've always done, much more intuitive.

Thanks for the tip,
Linn

"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:e6AbNp4mGHA.2312@TK2MSFTNGP03.phx.gbl...
> You should be able to use _Assign method to control the ActiveX .Visible.
>
> *YourContainer.visible_assign
> LPARAMETERS vNewVal
> *To do: Modify this routine for the Assign method
> THIS.Visible = m.vNewVal
> LOCAL x
> FOR x=1 TO this.ControlCount
> this.Controls[x].Visible = this.Visible
> ENDFOR
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
> news:kas6a2lih5ibnuh3vdhg6k6bvobf246smj@
4ax.com...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com