?? nvo_comctl_datetime.sru
字號:
public function long of_gethandle ();//====================================================================
// Function - of_gethandle for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Returns the handle to the datetime control
//--------------------------------------------------------------------
// Returns: (LONG) >0 = Window handle
// -1 = Invalid window
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
IF IsWindow( This.ilHandle ) THEN
RETURN This.ilHandle
ELSE
RETURN -1
END IF
end function
public subroutine of_sethandle (long alHandle);//====================================================================
// Function - of_sethandle for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Sets the handle of the visual control associated with
// this non-visual object. Usually, the of_Create method
// is used and the handle is set at the time of window
// creation. There is however a visual control as well
// (uo_comctl_datetime) that uses this non-visual object.
// The visual control will then call this function to
// set the window handle.
//--------------------------------------------------------------------
// Returns: (None)
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
IF IsWindow( alHandle ) THEN
IF IsWindow( This.ilHandle ) THEN
This.of_Destroy()
END IF
This.ilHandle = alHandle
END IF
RETURN
end subroutine
public function long of_getrange (ref datetime adtmin, ref datetime adtmax);//====================================================================
// Function - of_getrange for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Returns the minimum and maximum allowable values in the
// edit control. By default, there is no minimum of maximum
// range. Use of_SetRange() to specifiy a range.
//--------------------------------------------------------------------
// Arguments:
//
// REF datetime adtMin
// Minimum allowable value in edit control (if any)
// REF datetime adtMax
// Maximum allowable value in edit control (if any)
//--------------------------------------------------------------------
// Returns: LONG -1 = Invalid window
// 0 = No MIN or MAX value set
// 1 = MIN value is set
// 2 = MAX value is set
// 3 = MIN and MAX is set
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
long llRange
SYSTEMTIME lpSYSTEMTIME[2]
IF IsWindow( This.ilHandle ) THEN
llRange = SendMessageSystemTime( This.ilHandle, DTM_GETRANGE, 0, lpSYSTEMTIME )
ELSE
llRange = -1
END IF
CHOOSE CASE llRange
CASE GDTR_MIN // Min value
adtMin = This.of_GetDateTime( lpSYSTEMTIME[1] )
SetNull( adtMax )
CASE GDTR_MAX // Max value
SetNull( adtMin )
adtMax = This.of_GetDateTime( lpSYSTEMTIME[2] )
CASE GDTR_MIN + GDTR_MAX // Min and Max
adtMin = This.of_GetDateTime( lpSYSTEMTIME[1] )
adtMax = This.of_GetDateTime( lpSYSTEMTIME[2] )
CASE ELSE // Error, or no min/max
SetNull( adtMin )
SetNull( adtMax )
END CHOOSE
RETURN llRange
end function
public function boolean of_setrange (datetime adtMin, datetime adtMax);//====================================================================
// Function - of_setrange for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Sets the allowable input range for the edit control.
//--------------------------------------------------------------------
// Arguments:
//
// datetime adtMin
// Minimum allowable value. Set to NULL for no minimum
// datetime adtMax
// Maximum allowable value. Set to NULL for no maximum.
//--------------------------------------------------------------------
// Returns: (BOOLEAN) - TRUE = Range set successfully.
// FALSE = Could not set range (e.g. bad params)
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
long llRetVal, llMinMax
SYSTEMTIME lpSYSTEMTIME[2]
IF IsWindow( This.ilHandle ) THEN
llMinMax = 0
// Set minimum if date is not null, else any existing minimum will be removed
IF NOT IsNull( adtMin ) THEN
llMinMax += GDTR_MIN
This.of_GetSystemTime( adtMin, lpSYSTEMTIME[1] )
END IF
// Set maximum if date is not null, else any existing maximum will be removed
IF NOT IsNull( adtMax ) THEN
llMinMax += GDTR_MAX
This.of_GetSystemTime( adtMax, lpSYSTEMTIME[2] )
END IF
llRetVal = SendMessageSystemTime( This.ilHandle, DTM_SETRANGE, llMinMax, lpSYSTEMTIME )
ELSE
// Invalid window handle
llRetVal = 0
END IF
RETURN (llRetVal <> 0)
end function
public function boolean of_setformat (readonly string asformat);//====================================================================
// Function - of_setformat for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Sets the display format for the date/time control.
// See the GetTimeFormat and GetDateFormat API functions
// for valid formats.
//--------------------------------------------------------------------
// Arguments:
//
// string asformat
// <description>
//--------------------------------------------------------------------
// Returns: (BOOLEAN)
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
long llRetVal
IF IsWindow( This.ilHandle ) THEN
llRetVal = Send( This.ilHandle, DTM_SETFORMAT, 0, asFormat )
ELSE
llRetVal = 0
END IF
RETURN (llRetVal <> 0)
end function
public function boolean of_setmcolor (integer icolor, long lrgb);//====================================================================
// Function - of_setmcolor for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Sets the specified color of the calendar dropdown
//--------------------------------------------------------------------
// Arguments:
//
// integer iColor
// One of the MCSC_xxx constants (e.g. MCSC_BACKGROUND)
// long lRGB
// RGB value of the specified component
//--------------------------------------------------------------------
// Returns: (BOOLEAN) - TRUE = Color was successfully set.
// FALSE = Could not set color (e.g. bad params)
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
long llRetVal
IF IsWindow( This.ilHandle ) THEN
llRetVal = Send( This.ilHandle, DTM_SETMCCOLOR, iColor, lRGB )
ELSE
llRetVal = 0
END IF
RETURN (llRetVal <> 0)
end function
public function long of_getmcolor (integer icolor);//====================================================================
// Function - of_getmcolor for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Gets the specified color of the calendar control
//--------------------------------------------------------------------
// Arguments:
//
// integer iColor
// One of the MCSC_xxx constants (e.g. MCSC_BACKGROUND)
//--------------------------------------------------------------------
// Returns: (LONG) - RGB value of calendar control
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
IF IsWindow( This.ilHandle ) THEN
RETURN Send( This.ilHandle, DTM_GETMCCOLOR, iColor, 0)
ELSE
RETURN -1
END IF
end function
public function boolean of_setdatetime (datetime adtdatetime);//====================================================================
// Function - of_setdatetime for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Sets the time in the edit control.
//--------------------------------------------------------------------
// Arguments:
//
// datetime adtDateTime
// Date/Time to set
//--------------------------------------------------------------------
// Returns: BOOLEAN - TRUE = Date/Time was successfully set
// FALSE = Could not set date/time (e.g. bad params)
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
SYSTEMTIME lpSYSTEMTIME
long llRetVal
// Check if window is valid
IF IsWindow( This.ilHandle ) THEN
// A NULL date will set the control to a NONE date
IF IsNull( adtDateTime ) THEN
llRetVal = SendMessageSystemTime( This.ilHandle, DTM_SETSYSTEMTIME, GDT_NONE, lpSYSTEMTIME )
ELSE
// Convert PB datetime to SYSTEMTIME structure
This.of_GetSystemTime( adtDateTime, lpSYSTEMTIME )
llRetVal = SendMessageSystemTime( This.ilHandle, DTM_SETSYSTEMTIME, GDT_VALID, lpSYSTEMTIME )
END IF
ELSE
llRetVal = 0
END IF
RETURN (llRetVal <> 0)
end function
on nvo_comctl_datetime.create
TriggerEvent( this, "constructor" )
end on
on nvo_comctl_datetime.destroy
TriggerEvent( this, "destructor" )
end on
event constructor;//====================================================================
// Script - constructor for nvo_comctl_datetime
//--------------------------------------------------------------------
// Description:Initialize the DATE common controls. This will register
// the window classnames.
//--------------------------------------------------------------------
// Author: RCSIZER Date: September, 1999
//====================================================================
INITCOMMONCONTROLS lICC
// Set the size of the structure (2 longs = 8 bytes)
lICC.dwSize = 2 * 4
lICC.dwICC = ICC_DATE_CLASSES
// Initialise the DATE common controls
InitCommonControlsEx( lICC )
RETURN 0
end event
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -