HELP! - MS Calendar: Drop-Down for Month and Year Disabled.. 
Author Message
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..

I am have Using VB5 and have created a date control using a text box and a
popup Picturebox
which contains a Microsoft Calendar control. In the initialize of the
UserControl, I have placed the following two lines.

    SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW
    SetParent myPopupPictureBox.hwnd, 0

I then have a Popup routine which displays this window and then I setCapture
to this Window using the following line

    SetCapture myPopupPictureBox.hWnd

This works fine and I am able to select the days on the Calendar Control,
but the drop-downs for the month and year at the top of the Calendar control
seem to be disabled and i am unable to select them. Has anyone got any
Idea's as to why this may be occurring? This is driving me crazy....

Cheers

James E



Mon, 04 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
well I'll have one more stab at this:

You are creating a popup and setting the capture to it.  Could it be
possibly that when a combobox shows it's drop down list it is trying to do a
similar thing but can't because you haven't released capture.. ??


Quote:
> I am have Using VB5 and have created a date control using a text box and a
> popup Picturebox
> which contains a Microsoft Calendar control. In the initialize of the
> UserControl, I have placed the following two lines.

>     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW
>     SetParent myPopupPictureBox.hwnd, 0

> I then have a Popup routine which displays this window and then I
setCapture
> to this Window using the following line

>     SetCapture myPopupPictureBox.hWnd

> This works fine and I am able to select the days on the Calendar Control,
> but the drop-downs for the month and year at the top of the Calendar
control
> seem to be disabled and i am unable to select them. Has anyone got any
> Idea's as to why this may be occurring? This is driving me crazy....

> Cheers

> James E



Mon, 04 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
Well, I have tried it with setting the capture and without. In
UserControl_Initialize, I am setting the picturebox to not be visible, as
follows:

        myPopupPictureBox.visible = FALSE

Then in the routine that pops up the picturebox window I have the following
code:

        With myPopupPictureBox
                .Top = iTop
                .Left = iLeft
                .Visible = True
                .ZOrder
        End With

        SetCapture myPopupPictureBox.hWnd

Where I am calling the Zorder method, the window is shown and it is at this
point when I am stepping through the code, that I can see that the Calendar
controls drop-downs are disabled. I have tried commenting out the SetCapture
call, with identical results.
I was wondering whether the SetParent call might have caused a problem for
the calendar control, as the drop-down (list portion) of the combo-box is a
child of the desktop??


Quote:
> well I'll have one more stab at this:

> You are creating a popup and setting the capture to it.  Could it be
> possibly that when a combobox shows it's drop down list it is trying to do
a
> similar thing but can't because you haven't released capture.. ??



> > I am have Using VB5 and have created a date control using a text box and
a
> > popup Picturebox
> > which contains a Microsoft Calendar control. In the initialize of the
> > UserControl, I have placed the following two lines.

> >     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW
> >     SetParent myPopupPictureBox.hwnd, 0

> > I then have a Popup routine which displays this window and then I
> setCapture
> > to this Window using the following line

> >     SetCapture myPopupPictureBox.hWnd

> > This works fine and I am able to select the days on the Calendar
Control,
> > but the drop-downs for the month and year at the top of the Calendar
> control
> > seem to be disabled and i am unable to select them. Has anyone got any
> > Idea's as to why this may be occurring? This is driving me crazy....

> > Cheers

> > James E



Mon, 04 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
Hmm, I just checked and setcapture is definetly not the problem (although it
can cause others).

I created a from with a picture bow and tried setting the picture box's
parent to the desktop.  It seems to work, and although some controls such a
command buttons continue to work, there seemed to be some unstability,
especially if command button called on a Msgbox etc.  But a combo box
appeared enabled but was disfunctional, which is kinda how I'm feeling at
present cause I can't work it out.

Can't you create a form, and set the picturebox as a child of that form. ??
At least then all controls seem stable.


Quote:
> Well, I have tried it with setting the capture and without. In
> UserControl_Initialize, I am setting the picturebox to not be visible, as
> follows:

>         myPopupPictureBox.visible = FALSE

> Then in the routine that pops up the picturebox window I have the
following
> code:

>         With myPopupPictureBox
>                 .Top = iTop
>                 .Left = iLeft
>                 .Visible = True
>                 .ZOrder
>         End With

>         SetCapture myPopupPictureBox.hWnd

> Where I am calling the Zorder method, the window is shown and it is at
this
> point when I am stepping through the code, that I can see that the
Calendar
> controls drop-downs are disabled. I have tried commenting out the
SetCapture
> call, with identical results.
> I was wondering whether the SetParent call might have caused a problem for
> the calendar control, as the drop-down (list portion) of the combo-box is
a
> child of the desktop??



> > well I'll have one more stab at this:

> > You are creating a popup and setting the capture to it.  Could it be
> > possibly that when a combobox shows it's drop down list it is trying to
do
> a
> > similar thing but can't because you haven't released capture.. ??



> > > I am have Using VB5 and have created a date control using a text box
and
> a
> > > popup Picturebox
> > > which contains a Microsoft Calendar control. In the initialize of the
> > > UserControl, I have placed the following two lines.

> > >     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE,
WS_EX_TOOLWINDOW
> > >     SetParent myPopupPictureBox.hwnd, 0

> > > I then have a Popup routine which displays this window and then I
> > setCapture
> > > to this Window using the following line

> > >     SetCapture myPopupPictureBox.hWnd

> > > This works fine and I am able to select the days on the Calendar
> Control,
> > > but the drop-downs for the month and year at the top of the Calendar
> > control
> > > seem to be disabled and i am unable to select them. Has anyone got any
> > > Idea's as to why this may be occurring? This is driving me crazy....

> > > Cheers

> > > James E



Mon, 04 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
Bill, you aren't dysfunctional....in fact, you've cracked it. I've just got
a few things to iron out and then I should finally be able to finish this.
Thanks for your time and effort - much appreciated. Any idea why the
controls are unstable using the method I was trying to use?

Cheers

James.


Quote:
> Hmm, I just checked and setcapture is definetly not the problem (although
it
> can cause others).

> I created a from with a picture bow and tried setting the picture box's
> parent to the desktop.  It seems to work, and although some controls such
a
> command buttons continue to work, there seemed to be some unstability,
> especially if command button called on a Msgbox etc.  But a combo box
> appeared enabled but was disfunctional, which is kinda how I'm feeling at
> present cause I can't work it out.

> Can't you create a form, and set the picturebox as a child of that form.
??
> At least then all controls seem stable.



> > Well, I have tried it with setting the capture and without. In
> > UserControl_Initialize, I am setting the picturebox to not be visible,
as
> > follows:

> >         myPopupPictureBox.visible = FALSE

> > Then in the routine that pops up the picturebox window I have the
> following
> > code:

> >         With myPopupPictureBox
> >                 .Top = iTop
> >                 .Left = iLeft
> >                 .Visible = True
> >                 .ZOrder
> >         End With

> >         SetCapture myPopupPictureBox.hWnd

> > Where I am calling the Zorder method, the window is shown and it is at
> this
> > point when I am stepping through the code, that I can see that the
> Calendar
> > controls drop-downs are disabled. I have tried commenting out the
> SetCapture
> > call, with identical results.
> > I was wondering whether the SetParent call might have caused a problem
for
> > the calendar control, as the drop-down (list portion) of the combo-box
is
> a
> > child of the desktop??



> > > well I'll have one more stab at this:

> > > You are creating a popup and setting the capture to it.  Could it be
> > > possibly that when a combobox shows it's drop down list it is trying
to
> do
> > a
> > > similar thing but can't because you haven't released capture.. ??



> > > > I am have Using VB5 and have created a date control using a text box
> and
> > a
> > > > popup Picturebox
> > > > which contains a Microsoft Calendar control. In the initialize of
the
> > > > UserControl, I have placed the following two lines.

> > > >     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE,
> WS_EX_TOOLWINDOW
> > > >     SetParent myPopupPictureBox.hwnd, 0

> > > > I then have a Popup routine which displays this window and then I
> > > setCapture
> > > > to this Window using the following line

> > > >     SetCapture myPopupPictureBox.hWnd

> > > > This works fine and I am able to select the days on the Calendar
> > Control,
> > > > but the drop-downs for the month and year at the top of the Calendar
> > > control
> > > > seem to be disabled and i am unable to select them. Has anyone got
any
> > > > Idea's as to why this may be occurring? This is driving me crazy....

> > > > Cheers

> > > > James E



Mon, 04 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
Bill,
thanks for all your help. I still find myself with a problem though.
Previously, when the picturebox popped-up, I was able to go back and
manually edit the text in the textbox, with the picture box remaining in the
foreground. Now, when I have set the parent of the picturebox to be the form
and I pop-up the form, the form with the usercontrol on becomes Topmost,
putting the popup form behind it. I have tried setting the Zorder of the
popup form, but this looks terrible. Here's the code I have put in the
Initialize of the UserControl:

     dl& = GetDesktopWindow&
     SetWindowLong frmPopup.hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW
     SetParent myPopupPictureBox.hWnd, frmPopup.hWnd
     myPopupPictureBox.Move 0, 0
     SetParent frmPopup.hWnd, dl&

In the last line of code, I also tried:
 SetParent frmPopup.hWnd, 0
..although this makes no difference. I am obviously doing something wrong,
but at the moment it's just not jumpin out and kicking me in the face.
Any ideas?

Cheers

James


Quote:
> Hmm, I just checked and setcapture is definetly not the problem (although
it
> can cause others).

> I created a from with a picture bow and tried setting the picture box's
> parent to the desktop.  It seems to work, and although some controls such
a
> command buttons continue to work, there seemed to be some unstability,
> especially if command button called on a Msgbox etc.  But a combo box
> appeared enabled but was disfunctional, which is kinda how I'm feeling at
> present cause I can't work it out.

> Can't you create a form, and set the picturebox as a child of that form.
??
> At least then all controls seem stable.



> > Well, I have tried it with setting the capture and without. In
> > UserControl_Initialize, I am setting the picturebox to not be visible,
as
> > follows:

> >         myPopupPictureBox.visible = FALSE

> > Then in the routine that pops up the picturebox window I have the
> following
> > code:

> >         With myPopupPictureBox
> >                 .Top = iTop
> >                 .Left = iLeft
> >                 .Visible = True
> >                 .ZOrder
> >         End With

> >         SetCapture myPopupPictureBox.hWnd

> > Where I am calling the Zorder method, the window is shown and it is at
> this
> > point when I am stepping through the code, that I can see that the
> Calendar
> > controls drop-downs are disabled. I have tried commenting out the
> SetCapture
> > call, with identical results.
> > I was wondering whether the SetParent call might have caused a problem
for
> > the calendar control, as the drop-down (list portion) of the combo-box
is
> a
> > child of the desktop??



> > > well I'll have one more stab at this:

> > > You are creating a popup and setting the capture to it.  Could it be
> > > possibly that when a combobox shows it's drop down list it is trying
to
> do
> > a
> > > similar thing but can't because you haven't released capture.. ??



> > > > I am have Using VB5 and have created a date control using a text box
> and
> > a
> > > > popup Picturebox
> > > > which contains a Microsoft Calendar control. In the initialize of
the
> > > > UserControl, I have placed the following two lines.

> > > >     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE,
> WS_EX_TOOLWINDOW
> > > >     SetParent myPopupPictureBox.hwnd, 0

> > > > I then have a Popup routine which displays this window and then I
> > > setCapture
> > > > to this Window using the following line

> > > >     SetCapture myPopupPictureBox.hWnd

> > > > This works fine and I am able to select the days on the Calendar
> > Control,
> > > > but the drop-downs for the month and year at the top of the Calendar
> > > control
> > > > seem to be disabled and i am unable to select them. Has anyone got
any
> > > > Idea's as to why this may be occurring? This is driving me crazy....

> > > > Cheers

> > > > James E



Tue, 05 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
Okay, with our last solution we moved away from api a bit and used a form.
Why can't we just show the form like this

SetParent myPopupPictureBox.hWnd, frmPopup.hWnd
myPopupPictureBox.Move 0, 0
frmPopup.Show vbModeless, Me

Also I would not use the set windowlong unless you really have to.  better
to predifine the window attributes.
If you still have problems then I would try the SetWindowPos api.


Quote:
> Bill,
> thanks for all your help. I still find myself with a problem though.
> Previously, when the picturebox popped-up, I was able to go back and
> manually edit the text in the textbox, with the picture box remaining in
the
> foreground. Now, when I have set the parent of the picturebox to be the
form
> and I pop-up the form, the form with the usercontrol on becomes Topmost,
> putting the popup form behind it. I have tried setting the Zorder of the
> popup form, but this looks terrible. Here's the code I have put in the
> Initialize of the UserControl:

>      dl& = GetDesktopWindow&
>      SetWindowLong frmPopup.hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW
>      SetParent myPopupPictureBox.hWnd, frmPopup.hWnd
>      myPopupPictureBox.Move 0, 0
>      SetParent frmPopup.hWnd, dl&

> In the last line of code, I also tried:
>  SetParent frmPopup.hWnd, 0
> ..although this makes no difference. I am obviously doing something wrong,
> but at the moment it's just not jumpin out and kicking me in the face.
> Any ideas?

> Cheers

> James



> > Hmm, I just checked and setcapture is definetly not the problem
(although
> it
> > can cause others).

> > I created a from with a picture bow and tried setting the picture box's
> > parent to the desktop.  It seems to work, and although some controls
such
> a
> > command buttons continue to work, there seemed to be some unstability,
> > especially if command button called on a Msgbox etc.  But a combo box
> > appeared enabled but was disfunctional, which is kinda how I'm feeling
at
> > present cause I can't work it out.

> > Can't you create a form, and set the picturebox as a child of that form.
> ??
> > At least then all controls seem stable.



> > > Well, I have tried it with setting the capture and without. In
> > > UserControl_Initialize, I am setting the picturebox to not be visible,
> as
> > > follows:

> > >         myPopupPictureBox.visible = FALSE

> > > Then in the routine that pops up the picturebox window I have the
> > following
> > > code:

> > >         With myPopupPictureBox
> > >                 .Top = iTop
> > >                 .Left = iLeft
> > >                 .Visible = True
> > >                 .ZOrder
> > >         End With

> > >         SetCapture myPopupPictureBox.hWnd

> > > Where I am calling the Zorder method, the window is shown and it is at
> > this
> > > point when I am stepping through the code, that I can see that the
> > Calendar
> > > controls drop-downs are disabled. I have tried commenting out the
> > SetCapture
> > > call, with identical results.
> > > I was wondering whether the SetParent call might have caused a problem
> for
> > > the calendar control, as the drop-down (list portion) of the combo-box
> is
> > a
> > > child of the desktop??



> > > > well I'll have one more stab at this:

> > > > You are creating a popup and setting the capture to it.  Could it be
> > > > possibly that when a combobox shows it's drop down list it is trying
> to
> > do
> > > a
> > > > similar thing but can't because you haven't released capture.. ??



> > > > > I am have Using VB5 and have created a date control using a text
box
> > and
> > > a
> > > > > popup Picturebox
> > > > > which contains a Microsoft Calendar control. In the initialize of
> the
> > > > > UserControl, I have placed the following two lines.

> > > > >     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE,
> > WS_EX_TOOLWINDOW
> > > > >     SetParent myPopupPictureBox.hwnd, 0

> > > > > I then have a Popup routine which displays this window and then I
> > > > setCapture
> > > > > to this Window using the following line

> > > > >     SetCapture myPopupPictureBox.hWnd

> > > > > This works fine and I am able to select the days on the Calendar
> > > Control,
> > > > > but the drop-downs for the month and year at the top of the
Calendar
> > > > control
> > > > > seem to be disabled and i am unable to select them. Has anyone got
> any
> > > > > Idea's as to why this may be occurring? This is driving me
crazy....

> > > > > Cheers

> > > > > James E



Tue, 05 Feb 2002 03:00:00 GMT  
 HELP! - MS Calendar: Drop-Down for Month and Year Disabled..
Bill,
Everything seems to be working ok. I had to put the following in, because if
I placed the control on an MDI Child form, the MDI child can't be the
ownerform of the frmPopUp:

    If UserControl.Parent.MDIChild = True Then
        frmPopup.Show vbModeless, UserControl
    Else
        frmPopup.Show vbModeless, UserControl.Parent
    End If

This seems ok, not ideal. Now I have to get around the problem of when the
control is placed onto a form that is then shown modally.
However, it no longer feels like I'm fighting a losing battle!!

Cheers

James


Quote:
> Okay, with our last solution we moved away from api a bit and used a form.
> Why can't we just show the form like this

> SetParent myPopupPictureBox.hWnd, frmPopup.hWnd
> myPopupPictureBox.Move 0, 0
> frmPopup.Show vbModeless, Me

> Also I would not use the set windowlong unless you really have to.  better
> to predifine the window attributes.
> If you still have problems then I would try the SetWindowPos api.



> > Bill,
> > thanks for all your help. I still find myself with a problem though.
> > Previously, when the picturebox popped-up, I was able to go back and
> > manually edit the text in the textbox, with the picture box remaining in
> the
> > foreground. Now, when I have set the parent of the picturebox to be the
> form
> > and I pop-up the form, the form with the usercontrol on becomes Topmost,
> > putting the popup form behind it. I have tried setting the Zorder of the
> > popup form, but this looks terrible. Here's the code I have put in the
> > Initialize of the UserControl:

> >      dl& = GetDesktopWindow&
> >      SetWindowLong frmPopup.hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW
> >      SetParent myPopupPictureBox.hWnd, frmPopup.hWnd
> >      myPopupPictureBox.Move 0, 0
> >      SetParent frmPopup.hWnd, dl&

> > In the last line of code, I also tried:
> >  SetParent frmPopup.hWnd, 0
> > ..although this makes no difference. I am obviously doing something
wrong,
> > but at the moment it's just not jumpin out and kicking me in the face.
> > Any ideas?

> > Cheers

> > James



> > > Hmm, I just checked and setcapture is definetly not the problem
> (although
> > it
> > > can cause others).

> > > I created a from with a picture bow and tried setting the picture
box's
> > > parent to the desktop.  It seems to work, and although some controls
> such
> > a
> > > command buttons continue to work, there seemed to be some unstability,
> > > especially if command button called on a Msgbox etc.  But a combo box
> > > appeared enabled but was disfunctional, which is kinda how I'm feeling
> at
> > > present cause I can't work it out.

> > > Can't you create a form, and set the picturebox as a child of that
form.
> > ??
> > > At least then all controls seem stable.



> > > > Well, I have tried it with setting the capture and without. In
> > > > UserControl_Initialize, I am setting the picturebox to not be
visible,
> > as
> > > > follows:

> > > >         myPopupPictureBox.visible = FALSE

> > > > Then in the routine that pops up the picturebox window I have the
> > > following
> > > > code:

> > > >         With myPopupPictureBox
> > > >                 .Top = iTop
> > > >                 .Left = iLeft
> > > >                 .Visible = True
> > > >                 .ZOrder
> > > >         End With

> > > >         SetCapture myPopupPictureBox.hWnd

> > > > Where I am calling the Zorder method, the window is shown and it is
at
> > > this
> > > > point when I am stepping through the code, that I can see that the
> > > Calendar
> > > > controls drop-downs are disabled. I have tried commenting out the
> > > SetCapture
> > > > call, with identical results.
> > > > I was wondering whether the SetParent call might have caused a
problem
> > for
> > > > the calendar control, as the drop-down (list portion) of the
combo-box
> > is
> > > a
> > > > child of the desktop??



> > > > > well I'll have one more stab at this:

> > > > > You are creating a popup and setting the capture to it.  Could it
be
> > > > > possibly that when a combobox shows it's drop down list it is
trying
> > to
> > > do
> > > > a
> > > > > similar thing but can't because you haven't released capture.. ??



> > > > > > I am have Using VB5 and have created a date control using a text
> box
> > > and
> > > > a
> > > > > > popup Picturebox
> > > > > > which contains a Microsoft Calendar control. In the initialize
of
> > the
> > > > > > UserControl, I have placed the following two lines.

> > > > > >     SetWindowLong myPopupPictureBox.hwnd, GWL_EXSTYLE,
> > > WS_EX_TOOLWINDOW
> > > > > >     SetParent myPopupPictureBox.hwnd, 0

> > > > > > I then have a Popup routine which displays this window and then
I
> > > > > setCapture
> > > > > > to this Window using the following line

> > > > > >     SetCapture myPopupPictureBox.hWnd

> > > > > > This works fine and I am able to select the days on the Calendar
> > > > Control,
> > > > > > but the drop-downs for the month and year at the top of the
> Calendar
> > > > > control
> > > > > > seem to be disabled and i am unable to select them. Has anyone
got
> > any
> > > > > > Idea's as to why this may be occurring? This is driving me
> crazy....

> > > > > > Cheers

> > > > > > James E



Tue, 05 Feb 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. HELP! - MS Calendar: Drop-Down for Month and Year Disabled..

2. HELP! - MS Calendar: Drop-Down for Month and Year Disabled..

3. MS Calendar and DropDown ListBox for Month

4. Report: This year by month/ last year by month

5. Calendar funtions to go back 1 week, month, year

6. Listing Months, Days and Years in seperate drop combos

7. Listing Months, Days and Years in seperate drop combos

8. Listing Months, Days and Years in seperate drop combos

9. Disable IE5.5 drop down list when I type text within a web page - PLEASE HELP

10. drag-drop from Month Calendar control

11. Disable IE5.5 drop down list when I type text within a web page - PLEASE HELP

12. Disable IE5.5 drop down list when I type text within a web page - PLEASE HELP

 

 
Powered by phpBB® Forum Software