PALM开发教程-第七章 列表框和排序 |
| 作者:palmheart 来源:palmheart.net 发布时间:2005-12-21 3:33:26 |
|
of the button // CH.6 Set the ID buttonID = event->data.ctlSelect.controlID; // CH.6 Switch on button ID switch( buttonID ) { // CH.6 Hours button case EnterTimeHoursPushButton: // CH.6 Minute Tens button case EnterTimeMinuteTensPushButton: // CH.6 Minute Ones button case EnterTimeMinuteOnesPushButton: { // CH.6 If no time was set if( dateTime.hour == NO_TIME ) { // CH.6 Set the time to 12 PM dateTime.hour = 12; dateTime.minute = 0; // CH.6 Set the controls setTimeControls(); } // CH.6 Clear the old selection if any if( timeSelect ) CtlSetValue( getObject( form, timeSelect ), false ); // CH.6 Set the new selection CtlSetValue( getObject( form, buttonID ), true ); timeSelect = buttonID; } break; // CH.6 Up button case EnterTimeTimeUpRepeating: { // CH.6 If there's no time, do nothing if( dateTime.hour == NO_TIME ) break; // CH.6 Based on what push button is selected switch( timeSelect ) { // CH.6 Increase hours case EnterTimeHoursPushButton: { // CH.6 Increment hours dateTime.hour++; // CH.6 If it was 11 AM, make it 12 AM if( dateTime.hour == 12 ) dateTime.hour = 0; // CH.6 If it was 11 PM, make it 12 PM if( dateTime.hour == 24 ) dateTime.hour = 12; } break; // CH.6 Increase tens of minutes case EnterTimeMinuteTensPushButton: { // CH.6 Increment minutes dateTime.minute += 10; // CH.6 If it was 5X, roll over if( dateTime.minute > 59 ) dateTime.minute -= 60; } break; // CH.6 Increase minutes case EnterTimeMinuteOnesPushButton: { // CH.6 Increment minutes dateTime.minute++; // CH.6 If it is zero, subtract ten if( (dateTime.minute % 10) == 0 ) dateTime.minute -= 10; } break; } // Revise the controls setTimeControls(); } break; // CH.6 Down button case EnterTimeTimeDownRepeating: { // CH.6 If there's no time, do nothing if( dateTime.hour == NO_TIME ) break; // CH.6 Based on what push button is selected switch( timeSelect ) { // CH.6 Decrease hours case EnterTimeHoursPushButton: { // CH.6 Decrement hours dateTime.hour--; // CH.6 If it was 12 AM, make it 11 AM if( dateTime.hour == -1 ) dateTime.hour = 11; // CH.6 If it was 12 PM, make it 11 PM if( dateTime.hour == 11 ) dateTime.hour = 23; } break; // CH.6 Decrease tens of minutes case EnterTimeMinuteTensPushButton: { // CH.6 Decrement minutes dateTime.minute -= 10; // CH.6 If it was 0X, roll over if( dateTime.minute < 0 ) dateTime.minute += 60; } break; // CH.6 Decrease minutes case EnterTimeMinuteOnesPushButton: { // CH.6 Decrement minutes dateTime.minute--; // CH.6 If it is 9, add ten if( (dateTime.minute % 10) == 9 ) dateTime.minute += 10; // CH.6 If less than zero, make it 9 if( dateTime.minute < 0 ) dateTime.minute = 9; } break; } // CH.6 Revise the controls setTimeControls(); } break; // CH.6 AM button case EnterTimeAMPushButton: { // CH.6 If no time was set if( dateTime.hour == NO_TIME ) { // CH.6 Set the time to 12 AM dateTime.hour = 0; dateTime.minute = 0; // CH.6 Set the controls setTimeControls(); } // CH.6 If it is PM if( dateTime.hour > 11 ) { // CH.6 Change to AM dateTime.hour -= 12; // CH.6 Set the controls setTimeControls(); } } break; // CH.6 PM button case EnterTimePMPushButton: { // CH.6 If no time was set if( dateTime.hour == NO_TIME ) { // CH.6 Set the time to 12 PM dateTime.hour = 12; dateTime.minute = 0; // CH.6 Set the controls setTimeControls(); } // CH.6 If it is AM if( dateTime.hour < 12 ) { // CH.6 Change to PM dateTime.hour += 12; // CH.6 Set the controls setTimeControls(); } } break; // CH.6 No Time checkbox case EnterTimeNoTimeCheckbox: { // CH.6 If we are unchecking the box if( dateTime.hour == NO_TIME ) { // CH.6 Set the time to 12 PM dateTime.hour = 12; dateTime.minute = 0; // CH.6 Set the controls setTimeControls(); // CH.6 Set the new selection timeSelect = EnterTimeHoursPushButton; CtlSetValue( getObject( form, timeSelect ), true ); } else // CH.6 If we are checking the box dateTime.hour = NO_TIME; // CH.6 Set the controls setTimeControls(); } break; // CH.6 Cancel button case EnterTimeCancelButton: { // CH.6 Restore time dateTime = oldTime; // CH.6 Return to calling form FrmReturnToForm( 0 ); } // CH.6 Always return true return( true ); // CH.6 OK button case EnterTimeOKButton: { VoidPtr precord; // CH.6 Points to the record // CH.6 Lock it down precord = MemHandleLock( hrecord ); // CH.6 Write the date time field DmWrite( precord, DB_DATE_TIME_START, &dateTime, sizeof( DateTimeType ) ); // CH.6 Unlock the record MemHandleUnlock( hrecord ); // CH.6 Mark the record dirty isDirty = true; // CH.6 Return to the Contact Details form FrmReturnToForm( 0 ); // CH.6 Update the field setTimeTrigger(); } // CH.6 Always return true return( true ); } } break; } // CH.6 We're done return( false ); } // CH.7 Our Contact List form event handler function static Boolean contactListHandleEvent( EventPtr event ) |
| [] [返回上一页] [打 印] |
|
文章评论 |
