Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How to add dropdown Calendar control!!

6 posts in DataWindow .NET Last posting was on 2004-11-30 07:38:29.0Z
James Grote Posted on 2004-10-14 22:21:37.0Z
Sender: 2218.416efb4e.1804289383@sybase.com
From: James Grote
Newsgroups: sybase.public.datawindow.net
Subject: How to add dropdown Calendar control!!
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <416efbec.221b.1681692777@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 14 Oct 2004 15:21:32 -0700, 10.22.241.42
Lines: 44
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 14 Oct 2004 15:21:34 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 14 Oct 2004 15:21:37 -0700
X-Trace: forums-1-dub 1097792497 10.22.108.75 (14 Oct 2004 15:21:37 -0700)
X-Original-Trace: 14 Oct 2004 15:21:37 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:540
Article PK: 124974

Previously, someone suggested a method that sort of worked,
which inspired me to do this. Hope this helps!

How to show a dropdown calendar for all datetime fields:
1. Add MonthCalendar control to form. Set visible=false
2. Add a down-arrow button image next to datetime controls.
Name button same as datetime field, but with prefix like
"ddc_"
3. Add mouse down function for dw
private void dw_hh_address_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
Sybase.DataWindow.ObjectAtPointer obj =
dw_hh_address.ObjectUnderMouse;
Sybase.DataWindow.GraphicObject gob = obj.Gob;
System.Drawing.Point pointer;
MonthCalendar1.Hide();
// see if user clicked on a calendar dropdown button.
if (gob.Name.Substring(0,4) == "ddc")
{
// save name of datetime field
m_szSelectedDateField = gob.Name.Substring(4);

pointer = Control.MousePosition;

// add offset for dw location. if dw on tab control or
panel, add that location as well
pointer.X -= this.Location.X - dw_hh_address.Location.X +
MonthCalendar1.Width;
pointer.Y -= this.Location.Y - dw_hh_address.Location.Y +
10;
MonthCalendar1.Location = pointer;
MonthCalendar1.Show();
}
}
4. Add DateSelected event code for clicking on calendar
private void m_calUnavailableDate_DateSelected(object
sender, System.Windows.Forms.DateRangeEventArgs e)
{
dw_hh_address.SetItemDateTime(1, m_szSelectedDateField,
e.Start); // row=1 for a single-row dw form layout. diff
for grid, etc.
MonthCalendar1.Hide();
}


dfish Posted on 2004-10-15 12:25:36.0Z
From: dfish@_no_spam_sybase.com (Dave Fish [Team Sybase])
Newsgroups: sybase.public.datawindow.net
Subject: Re: How to add dropdown Calendar control!!
Organization: Sybase Professional Services
Reply-To: nospam_dfish@sybase.com_nospam
Message-ID: <416fc152.1304355@forums.sybase.com>
References: <416efbec.221b.1681692777@sybase.com>
X-Newsreader: Forte Free Agent 1.21/32.243
NNTP-Posting-Host: vpn-dub-080.sybase.com
X-Original-NNTP-Posting-Host: vpn-dub-080.sybase.com
Date: 15 Oct 2004 05:25:36 -0700
X-Trace: forums-1-dub 1097843136 10.22.120.80 (15 Oct 2004 05:25:36 -0700)
X-Original-Trace: 15 Oct 2004 05:25:36 -0700, vpn-dub-080.sybase.com
Lines: 63
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:541
Article PK: 124968

That's great! Thanks for sharing it. Do you mind if I put that
together as an example and upload it to our CodeXchange site? A very
useful utility until our Drop Down Calendar edit style is available
(in either version 1.5 or 2.0).

Thanks again!

Regards,
Dave Fish
Sybase

TeamSybase blogs: http://www.teamsybase.net/blogs

DataWindow.NET code examples available on CodeXchange:
http://datawindownet.codexchange.sybase.com

On 14 Oct 2004 15:21:37 -0700, James Grote wrote:

>Previously, someone suggested a method that sort of worked,
>which inspired me to do this. Hope this helps!
>
>How to show a dropdown calendar for all datetime fields:
>1. Add MonthCalendar control to form. Set visible=false
>2. Add a down-arrow button image next to datetime controls.
>Name button same as datetime field, but with prefix like
>"ddc_"
>3. Add mouse down function for dw
>private void dw_hh_address_MouseDown(object sender,
>System.Windows.Forms.MouseEventArgs e)
>{
> Sybase.DataWindow.ObjectAtPointer obj =
>dw_hh_address.ObjectUnderMouse;
> Sybase.DataWindow.GraphicObject gob = obj.Gob;
> System.Drawing.Point pointer;
> MonthCalendar1.Hide();
> // see if user clicked on a calendar dropdown button.
> if (gob.Name.Substring(0,4) == "ddc")
> {
> // save name of datetime field
> m_szSelectedDateField = gob.Name.Substring(4);
>
> pointer = Control.MousePosition;
>
> // add offset for dw location. if dw on tab control or
>panel, add that location as well
> pointer.X -= this.Location.X - dw_hh_address.Location.X +
>MonthCalendar1.Width;
> pointer.Y -= this.Location.Y - dw_hh_address.Location.Y +
>10;
> MonthCalendar1.Location = pointer;
> MonthCalendar1.Show();
> }
>}
>4. Add DateSelected event code for clicking on calendar
>private void m_calUnavailableDate_DateSelected(object
>sender, System.Windows.Forms.DateRangeEventArgs e)
>{
> dw_hh_address.SetItemDateTime(1, m_szSelectedDateField,
>e.Start); // row=1 for a single-row dw form layout. diff
>for grid, etc.
> MonthCalendar1.Hide();
>}


James Grote Posted on 2004-10-15 14:04:31.0Z
Sender: 2218.416efb4e.1804289383@sybase.com
From: James Grote
Newsgroups: sybase.public.datawindow.net
Subject: Re: How to add dropdown Calendar control!!
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <416fd8ea.2b49.1681692777@sybase.com>
References: <416fc152.1304355@forums.sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 15 Oct 2004 07:04:26 -0700, 10.22.241.42
Lines: 7
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 15 Oct 2004 07:04:28 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 15 Oct 2004 07:04:31 -0700
X-Trace: forums-1-dub 1097849071 10.22.108.75 (15 Oct 2004 07:04:31 -0700)
X-Original-Trace: 15 Oct 2004 07:04:31 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:546
Article PK: 124973


> That's great! Thanks for sharing it. Do you mind if I put
> that together as an example and upload it to our
> CodeXchange site? A very useful utility until our Drop
> Down Calendar edit style is available (in either version
> 1.5 or 2.0).

Don't mind at all!


Jack Addington Posted on 2004-11-19 16:20:43.0Z
From: "Jack Addington" <jaddington@shaw.ca>
Newsgroups: sybase.public.datawindow.net
References: <416fc152.1304355@forums.sybase.com> <416fd8ea.2b49.1681692777@sybase.com>
Subject: Re: How to add dropdown Calendar control!!
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: s010600e018e32f17.cg.shawcable.net
X-Original-NNTP-Posting-Host: s010600e018e32f17.cg.shawcable.net
Message-ID: <419e1d5b@forums-1-dub>
Date: 19 Nov 2004 08:20:43 -0800
X-Trace: forums-1-dub 1100881243 68.147.193.82 (19 Nov 2004 08:20:43 -0800)
X-Original-Trace: 19 Nov 2004 08:20:43 -0800, s010600e018e32f17.cg.shawcable.net
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:764
Article PK: 125192

I was looking at implementing this in my own way using a different calendar
control but I wanted to place the control on an inherited datawindowcontrol.

I have a dwAnc that I have inherited and extended. It makes more sense for
me put the calendar on the DW than individually on forms or on an ancestor
form (which I might end up doing if I can't get this to work).

Anyhow I cannot get the calendar to display. Is it possible to display
another graphical object on a DW or does it need to be owned by the parent
control? I basically dragged my calendar control onto the inherited
datawindow class and set its properties.

thx

jack

<James Grote> wrote in message news:416fd8ea.2b49.1681692777@sybase.com...
>> That's great! Thanks for sharing it. Do you mind if I put
>> that together as an example and upload it to our
>> CodeXchange site? A very useful utility until our Drop
>> Down Calendar edit style is available (in either version
>> 1.5 or 2.0).
>
> Don't mind at all!


Jack Addington Posted on 2004-11-19 16:25:42.0Z
From: "Jack Addington" <jaddington@shaw.ca>
Newsgroups: sybase.public.datawindow.net
References: <416fc152.1304355@forums.sybase.com> <416fd8ea.2b49.1681692777@sybase.com> <419e1d5b@forums-1-dub>
Subject: Re: How to add dropdown Calendar control!!
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: s010600e018e32f17.cg.shawcable.net
X-Original-NNTP-Posting-Host: s010600e018e32f17.cg.shawcable.net
Message-ID: <419e1e86$1@forums-1-dub>
Date: 19 Nov 2004 08:25:42 -0800
X-Trace: forums-1-dub 1100881542 68.147.193.82 (19 Nov 2004 08:25:42 -0800)
X-Original-Trace: 19 Nov 2004 08:25:42 -0800, s010600e018e32f17.cg.shawcable.net
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:765
Article PK: 125191

I was able to get the popup calendar to display by changing the parent of
the calendar at runtime from dw to the dw.Parent and then issuing a
bringToFront.

"Jack Addington" <jaddington@shaw.ca> wrote in message
news:419e1d5b@forums-1-dub...
>I was looking at implementing this in my own way using a different calendar
>control but I wanted to place the control on an inherited
>datawindowcontrol.
>
> I have a dwAnc that I have inherited and extended. It makes more sense
> for me put the calendar on the DW than individually on forms or on an
> ancestor form (which I might end up doing if I can't get this to work).
>
> Anyhow I cannot get the calendar to display. Is it possible to display
> another graphical object on a DW or does it need to be owned by the parent
> control? I basically dragged my calendar control onto the inherited
> datawindow class and set its properties.
>
> thx
>
> jack
>
> <James Grote> wrote in message news:416fd8ea.2b49.1681692777@sybase.com...
>>> That's great! Thanks for sharing it. Do you mind if I put
>>> that together as an example and upload it to our
>>> CodeXchange site? A very useful utility until our Drop
>>> Down Calendar edit style is available (in either version
>>> 1.5 or 2.0).
>>
>> Don't mind at all!
>
>


Tim Courtney Posted on 2004-11-30 07:38:29.0Z
Reply-To: "Tim Courtney" <tim@crcorp.com>
From: "Tim Courtney" <tim@crcorp.com>
Newsgroups: sybase.public.datawindow.net
References: <416efbec.221b.1681692777@sybase.com> <416fc152.1304355@forums.sybase.com>
Subject: Re: How to add dropdown Calendar control!!
Lines: 72
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: cc4-24.207.135.22.charter-stl.com
X-Original-NNTP-Posting-Host: cc4-24.207.135.22.charter-stl.com
Message-ID: <41ac2375$1@forums-1-dub>
Date: 29 Nov 2004 23:38:29 -0800
X-Trace: forums-1-dub 1101800309 24.207.135.22 (29 Nov 2004 23:38:29 -0800)
X-Original-Trace: 29 Nov 2004 23:38:29 -0800, cc4-24.207.135.22.charter-stl.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:837
Article PK: 125265

This works but how do I get the calendar to pop up exactly under the column?
It pops up close but not exact since it uses the mouse coordinates.

Tim

"Dave Fish [Team Sybase]" <dfish@_no_spam_sybase.com> wrote in message
news:416fc152.1304355@forums.sybase.com...
> That's great! Thanks for sharing it. Do you mind if I put that
> together as an example and upload it to our CodeXchange site? A very
> useful utility until our Drop Down Calendar edit style is available
> (in either version 1.5 or 2.0).
>
> Thanks again!
>
> Regards,
> Dave Fish
> Sybase
>
> TeamSybase blogs: http://www.teamsybase.net/blogs
>
> DataWindow.NET code examples available on CodeXchange:
> http://datawindownet.codexchange.sybase.com
>
> On 14 Oct 2004 15:21:37 -0700, James Grote wrote:
>
>>Previously, someone suggested a method that sort of worked,
>>which inspired me to do this. Hope this helps!
>>
>>How to show a dropdown calendar for all datetime fields:
>>1. Add MonthCalendar control to form. Set visible=false
>>2. Add a down-arrow button image next to datetime controls.
>>Name button same as datetime field, but with prefix like
>>"ddc_"
>>3. Add mouse down function for dw
>>private void dw_hh_address_MouseDown(object sender,
>>System.Windows.Forms.MouseEventArgs e)
>>{
>> Sybase.DataWindow.ObjectAtPointer obj =
>>dw_hh_address.ObjectUnderMouse;
>> Sybase.DataWindow.GraphicObject gob = obj.Gob;
>> System.Drawing.Point pointer;
>> MonthCalendar1.Hide();
>> // see if user clicked on a calendar dropdown button.
>> if (gob.Name.Substring(0,4) == "ddc")
>> {
>> // save name of datetime field
>> m_szSelectedDateField = gob.Name.Substring(4);
>>
>> pointer = Control.MousePosition;
>>
>> // add offset for dw location. if dw on tab control or
>>panel, add that location as well
>> pointer.X -= this.Location.X - dw_hh_address.Location.X +
>>MonthCalendar1.Width;
>> pointer.Y -= this.Location.Y - dw_hh_address.Location.Y +
>>10;
>> MonthCalendar1.Location = pointer;
>> MonthCalendar1.Show();
>> }
>>}
>>4. Add DateSelected event code for clicking on calendar
>>private void m_calUnavailableDate_DateSelected(object
>>sender, System.Windows.Forms.DateRangeEventArgs e)
>>{
>> dw_hh_address.SetItemDateTime(1, m_szSelectedDateField,
>>e.Start); // row=1 for a single-row dw form layout. diff
>>for grid, etc.
>> MonthCalendar1.Hide();
>>}
>