of_setdate


pfcmain.pbl   >   pfc_u_calendar   >   of_setdate   

Full name pfc_u_calendar.of_setdate
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_setdate(date,boolean)

Name Datatype
No Data

Name Datatype
li_day Integer
li_FirstDayNum Integer
li_month Integer
li_rc Integer
li_year Integer
ls_date String
ls_newcell String

protected function integer of_setdate (date ad_date, boolean ab_setrequestor);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_SetDate
//
//	Access:    Protected
//
//	Arguments:
//  ad_date		The date to set.
//	 ab_setrequestor	Switch stating if the requestor object should get this date.
//
//	Returns:  Integer
//		1 if it succeeds and -1 if an error occurs.
//
//	Description: Sets a new date on the Visual calendar date.  If appropriate, it
//		will also set the requestor to get this new date.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//	7.0	Add code to always redraw for date matching 1/1/1900 to allow date 
//			display for January 1900.  Previously the calendar did not redraw since 
//			the initial value of the previous date was also 1/1/1900.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

Integer			li_rc = 1
Integer 			li_month
Integer 			li_year
Integer 			li_day
Integer  		li_FirstDayNum
String			ls_newcell
String			ls_date

// Check the argument(s).
If Not inv_datetime.of_IsValid(ad_date) Then
	Return -1
End If

// Set the new date.
id_date = ad_date

// If appropriate, set the requestor with the new date.
If ab_setrequestor Then
	// Convert the date into a string.
	ls_date = string(ad_date, is_dateformat)

	// Set the requestor with the new date.
	If IsValid(idw_requestor) Then
		idw_requestor.SetText(ls_date)
	ElseIf IsValid(iem_requestor) Then
		iem_requestor.Text = ls_date	
	Else 
		Return -1
	End If
End If
						 
//If appropriate, draw a new month.
If (Year(ad_date) <> Year(id_prevdate) Or Month(ad_date) <> Month(id_prevdate)) Or &
	ib_alwaysredraw Or (ad_date = date(1900, 1, 1)) Then
	of_DrawMonth(ad_date)
End If
						 
//Initialize local values.
li_year = Year(ad_date)
li_month = Month(ad_date)
li_day = Day(ad_date)

// Unhighlight any previous cell.
If Len(Trim(is_prevcell)) > 0 Then
	If dw_cal.Modify(is_prevcell + ".border=0") <> "" Then
		li_rc = -1
	End If
End If

//Highlight the current date.
li_FirstDayNum = DayNumber(Date(li_year, li_month, 1))
ls_newcell = 'cell'+string(li_FirstDayNum + li_day - 1)
If dw_cal.Modify(ls_newcell + ".border=5") <> "" Then
	li_rc = -1
End if

// Store the new previous infomration.
is_prevcell = ls_newcell
id_prevdate = ad_date

Return li_rc




end function

     
Name Owner
pfc_u_calendar.of_reset pfc_u_calendar
pfc_u_calendar.dw_cal.pfc_nextmonth dw_cal
pfc_u_calendar.dw_cal.pfc_prevmonth dw_cal
pfc_u_calendar.dw_cal.pfc_nextday dw_cal
pfc_u_calendar.dw_cal.pfc_prevday dw_cal
pfc_u_calendar.dw_cal.pfc_prevweek dw_cal
pfc_u_calendar.dw_cal.pfc_nextweek dw_cal
pfc_u_calendar.dw_cal.key dw_cal
pfc_u_calendar.dw_cal.clicked dw_cal

     
Name Owner
datawindow.modify datawindow
datawindow.settext datawindow
systemfunctions.date systemfunctions
systemfunctions.day systemfunctions
systemfunctions.daynumber systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.month systemfunctions
systemfunctions.string systemfunctions
systemfunctions.string systemfunctions
systemfunctions.trim systemfunctions
systemfunctions.year systemfunctions
pfc_n_cst_datetime.of_isvalid pfc_n_cst_datetime
pfc_u_calendar.of_drawmonth pfc_u_calendar

     
Full name
pfc_u_calendar

     
Name Scope
No Data