void __fastcall TMain::btnDatePrevClick(TObject * Sender) { DateTimePicker->Date = DateTimePicker->Date + ((TSpeedButton*) Sender)->Tag; Memo->Clear(); UpdateDateTime(); }
void CUIPdaWnd::Update() { inherited::Update (); UpdateDateTime (); // Real Wolf: если предмет убрали, когда окно было открыто, то закрываем его. 07.08.2014. #if defined(UI_LOCK_PDA_WITHOUT_PDA_IN_SLOT) if (!g_actor->inventory().m_slots[PDA_SLOT].m_pIItem && IsShown() ) GetHolder()->StartStopMenu(this, true); #endif }
void __fastcall TMain::FormCreate(TObject *Sender) { DateTimePicker->Date = Date() - 1; TFileIni* FileIni = CreateINIFile(); ReportType = FileIni->ReadInteger("Report", "Type", 0); FileIni->ReadFormBounds(this); delete FileIni; UpdateDateTime(); }
void __fastcall TMain::DateTimePickerChange(TObject * Sender) { Memo->Clear(); UpdateDateTime(); }
void CUIPdaWnd::Update() { inherited::Update (); UpdateDateTime (); }
WORD ProcessMessageTime( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg ) { signed char change; WORD controlID; signed char day; signed char dayMax; signed char hour; signed char minute; signed char month; signed char year; controlID = GetObjID(pObj); switch (controlID) { case ID_RTCC_BUTTON_NEXT: // Show the old control set as unselected. IndicateFocus( BLACK ); // Set the next control as active. currentControlSet ++; if (currentControlSet > CONTROL_SET_MAX) { currentControlSet = 0; } // Show the new control set as selected. IndicateFocus( WHITE ); return 0; // Hidden button break; case ID_RTCC_BUTTON_PREVIOUS: // Show the old control set as unselected. IndicateFocus( BLACK ); // Set the next control as active. currentControlSet --; if (currentControlSet < 0 ) { currentControlSet = CONTROL_SET_MAX; } // Show the new control set as selected. IndicateFocus( WHITE ); return 0; // Hidden button break; case ID_RTCC_BUTTON_HOME: screenState = SCREEN_DISPLAY_MAIN; return 0; // Hidden button break; case ID_DAY_PLUS: case ID_MONTH_PLUS: case ID_YEAR_PLUS: case ID_HOUR_PLUS: case ID_MINUTE_PLUS: if (translatedMsg == BTN_MSG_PRESSED) { change = +1; } else { return 1; } break; case ID_DAY_MINUS: case ID_MONTH_MINUS: case ID_YEAR_MINUS: case ID_HOUR_MINUS: case ID_MINUTE_MINUS: if (translatedMsg == BTN_MSG_PRESSED) { change = -1; } else { return 1; } break; default: return 0; } // Update the selected field. RTCCProcessEvents(); hour = RTCCGetBinHour(); minute = RTCCGetBinMin(); day = RTCCGetBinDay(); month = RTCCGetBinMonth(); year = RTCCGetBinYear(); dayMax = daysPerMonth[month-1]; // February has one day more for a leap year, unless it is on the thousands if ((month == 2) && ((year % 4) == 0) && (year != 0)) { dayMax ++; } // Change the appropriate setting. Allow the controls to roll over. switch (currentControlSet) { case CONTROL_SET_DAY: day += change; if (day < 1) { day = dayMax; } if (day > dayMax) { day = 1; } break; case CONTROL_SET_MONTH: month += change; if (month < 1) { month = 12; } if (month > 12) { month = 1; } break; case CONTROL_SET_YEAR: year += change; if (year < 0) { year = 99; } if (year > 99) { year = 0; } break; case CONTROL_SET_HOUR: hour += change; if (hour < 0) { hour = 23; } if (hour > 23) { hour = 0; } break; case CONTROL_SET_MINUTE: minute += change; if (minute < 0) { minute = 59; } if (minute > 59) { minute = 0; } break; default: return 0; } RTCCOff(); RTCCSetBinHour( hour ); RTCCSetBinMin( minute ); RTCCSetBinSec( 0 ); RTCCSetBinMonth( month ); RTCCSetBinYear( year ); RTCCSetBinDay( day ); RTCCCalculateWeekDay(); RTCCSet(); // Copy the new values to the RTCC registers UpdateDateTime(); // Update the display. return 1; // Call the default handler to show the button state. }