Component* Button::updateFocus(int direction, int buttonsPressed) { Component* newFocus = NULL; if(!getFocus() && active) { setFocus(true); newFocus = this; } else if (!getFocus() && !active) { //try to move direction, and if new component found send to focus manager and remove focus for current component if (getNextFocus(direction)) newFocus = (getNextFocus(direction))->updateFocus(direction, buttonsPressed); else newFocus = getNextFocus(direction); } else { if (getNextFocus(direction)) newFocus = (getNextFocus(direction))->updateFocus(direction, buttonsPressed); if (newFocus) setFocus(false); else newFocus = this; } if (newFocus == this) { //finally update button behavior based on buttons pressed if(buttonsPressed & Focus::ACTION_BACK) doReturn(); else if (buttonsPressed & Focus::ACTION_SELECT) doClicked(); } return newFocus; }
void __fastcall TContestEntryDetails::FormShow( TObject * /*Sender*/ ) { // ScaleBy( TContestApp::getContestApp() ->sysfont->Size, Font->Size ); // Font->Assign( TContestApp::getContestApp() ->sysfont ); QTHBundleFrame->initialise( "QTH", &contest->QTHBundle, &contest->QTHBundleName ); StationBundleFrame->initialise( "Station", &contest->stationBundle, &contest->stationBundleName ); EntryBundleFrame->initialise( "Entry", &contest->entryBundle, &contest->entryBundleName ); ContestNameSelected->Text = contest->VHFContestName.getValue().c_str(); contest->initialiseINI(); for ( int i = 0; i < 24; i++ ) { std::string cbText = ( boost::format( "%02.2d:" ) % i ).str(); std::string hour = cbText + "00"; std::string halfhour = cbText + "30"; StartTimeCombo->Items->Add( hour.c_str() ); StartTimeCombo->Items->Add( halfhour.c_str() ); EndTimeCombo->Items->Add( hour.c_str() ); EndTimeCombo->Items->Add( halfhour.c_str() ); } if ( getDetails( ) ) { TWinControl *next = getNextFocus(); if ( next ) { next->SetFocus(); } } }
void __fastcall TContestEntryDetails::OKButtonClick( TObject * /*Sender*/ ) { // make sure we have the minimum required information if ( getDetails( ) ) { TWinControl * next = getNextFocus(); if ( next ) { next->SetFocus(); return ; } *inputcontest = *contest; ModalResult = mrOk; } }
void __fastcall TContestEntryDetails::BundleFrameBundleEditClick( TObject *Sender) { TButton *cb = dynamic_cast<TButton *>(Sender ); TSettingBundleFrame *bf = dynamic_cast<TSettingBundleFrame *>(cb->Parent); if (bf) { bf->BundleEditClick(Sender); } getDetails( ); // override from the window contest->setINIDetails(); setDetails( ); TWinControl *next = getNextFocus(); if (next) { next->SetFocus(); } else { OKButton->SetFocus(); } }
void __fastcall TContestEntryDetails::VHFCalendarButtonClick( TObject * /*Sender*/ ) { std::auto_ptr <TCalendarForm> CalendarDlg(new TCalendarForm(this)); CalendarDlg->Caption = "VHF Calendar"; CalendarDlg->description = ContestNameSelected->Text; if ( CalendarDlg->ShowModal() == mrOk ) { // set up all the details that we can from the calendar ContestNameSelected->Text = CalendarDlg->ic.description.c_str(); setDetails( CalendarDlg->ic ); } TWinControl *next = getNextFocus(); if (next) { next->SetFocus(); } else { OKButton->SetFocus(); } }
//--------------------------------------------------------------------------- TWinControl * TContestEntryDetails::getDetails( ) { TWinControl *nextD = getNextFocus(); contest->name.setValue( ContestNameEdit->Text.c_str() ); contest->band.setValue( BandComboBox->Text.c_str() ); contest->entSect.setValue( SectionComboBox->Text.c_str() ); contest->sectionList.setValue( sectionList.c_str() ); try { if (StartDateEdit->Text.IsEmpty()) { StartDateEdit->Text = TDateTime::CurrentDate(); } TDateTime test = TDateTime( StartDateEdit->Text, TDateTime::Date ); if ( ( int ) test > 0 ) contest->DTGStart.setValue( TDTToCanonical( StartDateEdit->Text + " " + StartTimeCombo->Text ).c_str() ); else contest->DTGStart.setValue( "" ); } catch ( EConvertError & ) { MinosParameters::getMinosParameters() ->mshowMessage ( StartDateEdit->Text + " " + StartTimeCombo->Text + " is not a good date/time (DD/MM/CCYY HH:NN)" , this ); nextD = (nextD?nextD:StartDateEdit); } try { if (EndDateEdit->Text.IsEmpty()) { EndDateEdit->Text = TDateTime::CurrentDate(); } TDateTime test = TDateTime( EndDateEdit->Text, TDateTime::Date ); if ( ( int ) test > 0 ) contest->DTGEnd.setValue( TDTToCanonical( EndDateEdit->Text + " " + EndTimeCombo->Text ).c_str() ); else contest->DTGEnd.setValue( "" ); } catch ( EConvertError & ) { MinosParameters::getMinosParameters() ->mshowMessage( EndDateEdit->Text + " " + EndTimeCombo->Text + " is not a good date/time (DD/HH/CCYY HH:NN)", this ); nextD = (nextD?nextD:EndDateEdit); } contest->mycall.fullCall.setValue( CallsignEdit->Text.c_str() ); contest->mycall.valRes = CS_NOT_VALIDATED; contest->mycall.validate(); if ( contest->mycall.valRes != CS_OK ) { nextD = (nextD?nextD:CallsignEdit); } contest->myloc.loc.setValue( LocatorEdit->Text.c_str() ); contest->myloc.validate(); if ( contest->myloc.valRes != LOC_OK ) { nextD = (nextD?nextD:LocatorEdit); } if ( contest->currentOp1.getValue().size() == 0 ) { nextD = (nextD?nextD:MainOpComboBox); } contest->allowLoc4.setValue( AllowLoc4CB->Checked ); // bool contest->allowLoc8.setValue( AllowLoc8CB->Checked ); // bool contest->location.setValue( ExchangeEdit->Text.c_str() ); contest->scoreMode.setValue( ( SCOREMODE ) ScoreOptions->ItemIndex ); // combo contest->countryMult.setValue( DXCCMult->Checked ); // bool contest->locMult.setValue( LocatorMult->Checked ) ; // bool if (ProtectedOption->Checked && contest->isProtected() && contest->isProtectedSuppressed()) { contest->setProtectedSuppressed(false); } else { if (ProtectedOption->Checked && !contest->isProtected()) { contest->setProtected( true ) ; saveContestOK = true; } else if (!ProtectedOption->Checked && contest->isProtected()) { contest->setProtected( false ) ; saveContestOK = true; } else if (!contest->isReadOnly()) // not protected, not unwriteable, protected but suppressed { saveContestOK = true; } } /* ExchangeComboBox: No Exchange Required PostCode Multipliers Other Exchange Multiplier Exchange Required (no multiplier) */ switch ( ExchangeComboBox->ItemIndex ) { case 0: contest->otherExchange.setValue( false ); contest->districtMult.setValue( false ); break; case 1: contest->otherExchange.setValue( true ); contest->districtMult.setValue( true ); break; case 2: contest->otherExchange.setValue( true ); contest->districtMult.setValue( false ); break; case 3: contest->otherExchange.setValue( true ); contest->districtMult.setValue( false ); break; } contest->RSTField.setValue( RSTField->Checked ) ; // bool contest->serialField.setValue( SerialField->Checked ) ; // bool contest->locatorField.setValue( LocatorField->Checked ) ; // bool contest->QTHField.setValue( QTHField->Checked ) ; // bool contest->power.setValue( PowerEdit->Text.c_str() ); contest->currentOp1.setValue(MainOpComboBox->Text.c_str()); contest->currentOp2.setValue(SecondOpComboBox->Text.c_str()); contest->oplist.insert(contest->currentOp1.getValue()); contest->oplist.insert(contest->currentOp2.getValue()); contest->validateLoc(); return nextD; }