Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Issue with Date Picker - SetAutoSize(TRUE)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Issue with Date Picker - SetAutoSize(TRUE)

 Post Reply Post Reply
Author
Message
amitb View Drop Down
Groupie
Groupie
Avatar

Joined: 13 September 2006
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote amitb Quote  Post ReplyReply Direct Link To This Post Topic: Issue with Date Picker - SetAutoSize(TRUE)
    Posted: 22 September 2008 at 8:24am
I am using SetAutoSize(TRUE).
Now when i resize the window to a normal size it looks like



Now if i resize this to medium size it looks like :



The PROBLEM IS WITH THE FOLLOWING:
If i resize it to a max size, then i can see only 1 line of minimonths...when actually i expect it to be filled properly and show me 12 months (which is my range) . WHAT should i do to see the 12 months in this size ???

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2008 at 2:22am
Hi,
Maybe you call SetAutoSize(FALSE) later ?  Can't reproduce it with our sample :(
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
amitb View Drop Down
Groupie
Groupie
Avatar

Joined: 13 September 2006
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote amitb Quote  Post ReplyReply Direct Link To This Post Posted: 25 September 2008 at 4:13am
Please find the code attached and also the .exe file.

If you execute this and try to resize the window (which contains a date picker control), then you can reproduce the problem of resizing.

When you maximize the windows, it only shows one row for months, where actually there is ample space to display 12 months.

Works fine in following case :



NOT WORKING in following case :


uploads/20080925_041324_TestEXE.zip
Back to Top
amitb View Drop Down
Groupie
Groupie
Avatar

Joined: 13 September 2006
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote amitb Quote  Post ReplyReply Direct Link To This Post Posted: 25 September 2008 at 4:16am
Here is the source code attached uploads/20080925_041557_Test-Code.zip
Back to Top
amitb View Drop Down
Groupie
Groupie
Avatar

Joined: 13 September 2006
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote amitb Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2008 at 12:29am
Hello CJ Team,
 
Can you please provide feedback over the sample that i have attached?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2008 at 6:18am
Hello,
 
I checked code and actually it is designed :(  Don't use SerRange if you don't need it
. Second row need show same months but it will go out your range.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2008 at 6:22am
Hi,
 
Lets patch CSize CXTPDatePickerControl::SetGridDimentions(CRect rcClient) method for 12 months case:
 
add this
if (nTotalMaxRangeMonths == 12 && m_nColumns >= 6 && m_nRows >= 2)
   {
    m_nColumns = 6;
    m_nRows = 2;   
   }
 
before while (m_nRows * m_nColumns > nTotalMaxRangeMonths).
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
amitb View Drop Down
Groupie
Groupie
Avatar

Joined: 13 September 2006
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote amitb Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2008 at 9:33am

Thanks Oleg,

It worked :)

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2009 at 8:07am
Unfortunately this algo it not works properly in many cases.
I modified it and add new function

//allow scrolling between FirstDay and LastDay and try to show initial visible range between FirstVisibleDay and LastVisibleDay

virtual void SetDesiredVisibleAndFullRange(COleDateTime FirstVisibleDay, COleDateTime LastVisibleDay,

COleDateTime FirstDay, COleDateTime LastDay);

and modified version of virtual void SetGridSize(int nRows, int nCols, BOOL bRestrictMode = FALSE);

if bRestrictMode Picker keep given matrix nRows x nCols as max for layout

Be in Release 13.1
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.