Print Page | Close Window

SetCurSel() doesn't work

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=10252
Printed Date: 11 May 2024 at 8:06am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SetCurSel() doesn't work
Posted By: tiratano
Subject: SetCurSel() doesn't work
Date Posted: 15 April 2008 at 10:27pm
Hi,
 
I want to change focused date, so I used SetCurSel() function.
However, it didn't work. Here is my code. Is there anyone who can point out the problem?
 
I'm using Xtreame ToolkitPro 2005 (10.3.1) on Windows XP Professional
 
==============================================
 
CXTPDatePickerControl wndDatePicker;
 
 CXTPWindowRect rcPopup(GetDlgItem(IDC_STARTDATE_SEARCH));
 CRect rc;
 wndDatePicker.GetMinReqRect(&rc);
 
 rc.InflateRect(0 ,0, 4, 4);
 rc.OffsetRect(rcPopup.right - rc.Width(), rcPopup.bottom);
 COleDateTime dt1(2008, 4, 1, 0, 0, 0);
 wndDatePicker.SetCurSel(dt1); // <= why it doesn't work?
 wndDatePicker.SetButtonsVisible(TRUE, FALSE);
 wndDatePicker.SetShowWeekNumbers(TRUE);
 CString strResult = _T("");
 if (wndDatePicker.GoModal(rc, this))
 {
  COleDateTime dtFrom;
  COleDateTime dtTo;
  if (wndDatePicker.GetSelRange(dtFrom, dtTo))
  {
   if (dtFrom == dtTo)
   {
    strResult.Format(_T("%4d-%02d-%02d"), 
     dtFrom.GetYear(), dtFrom.GetMonth(), dtFrom.GetDay());
   } else
   {
    // edit
    strResult.Format(_T("%4d.%02d.%02d - %4d.%02d.%02d"),
     dtFrom.GetYear(), dtFrom.GetMonth(), dtFrom.GetDay(),
     dtTo.GetYear(), dtTo.GetMonth(), dtTo.GetDay());
   }
  }
  else
   strResult = strCurrentText;
 }
 else
  strResult = strCurrentText;
 this->m_StartDateEdit.SetWindowText(strResult);



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net