string ExternClientInputTemplate::getQuestion(const string& lastAnswer) { static string lastQuestion; static vector<string> answer; answer.push_back(lastAnswer); if( m_sAnswerEndString != "" && m_sAnswerEndString != lastAnswer ) { return lastQuestion; } lastQuestion= getQuestion(answer); answer.clear(); return lastQuestion; }
void main() { TRISC=0; TRISA=0; TRISB=0; PORTB=0; PORTA=0; PORTC=0; TRISB.7=1; TX9=0; SPEN=1; TRMT=0; TX9D=0; SYNC=0; BRGH=1; BRG16=1; SPBRG= 103; TXEN=1; TRISA.0=1;//AN0 INPUT ANSEL.0=1; //AN0 analog ADCON0=0b10000000; //h¿jre justeret og AN2s ADCON1=0x00; //Vi starter vores while loop og den indeholder vores program. while (1) { //Vores program er ret kort. Det meste ligger ikke i vores main funktion. //Vores f¿rste funktion er getQuestion. Den bliver kaldt hele men funktionen begynder ikke f¿r den for besked fra PIC-2. //Det kan ses i dens funktion senere i koden. getQuestion(); //Vi har et meget kort delay. timerDelay(160); } }
BOOL AP_Win32Dialog_GenericInput::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) { m_hOk = GetDlgItem(hWnd, AP_RID_DIALOG_GENERICINPUT_OK_BUTTON); UT_return_val_if_fail(m_hOk, false); m_hWnd = hWnd; // Get ourselves a custom DialogHelper DELETEP(m_pWin32Dialog); m_pWin32Dialog = new XAP_Win32DialogHelper(hWnd); // Center Window m_pWin32Dialog->centerDialog(); // set the dialog title m_pWin32Dialog->setDialogTitle(getTitle().utf8_str()); // set the question SetDlgItemTextA(hWnd, AP_RID_DIALOG_GENERICINPUT_QUESTION, getQuestion().utf8_str()); SetDlgItemTextA(hWnd, AP_RID_DIALOG_GENERICINPUT_LABEL, getLabel().utf8_str()); // set the password char for the password field if (isPassword()) { HWND hPasswordEntry = GetDlgItem(hWnd, AP_RID_DIALOG_GENERICINPUT_PASSWORD_EDIT); UT_return_val_if_fail(hPasswordEntry != NULL, false) SendMessage(hPasswordEntry, EM_SETPASSWORDCHAR, '*', 0); } // set the initial input SetDlgItemTextA(hWnd, AP_RID_DIALOG_GENERICINPUT_PASSWORD_EDIT, getInput().utf8_str()); // force the initial sensitivy state of the buttons _eventTextChanged(); return true; }
GtkWidget * AP_UnixDialog_GenericInput::_constructWindow(void) { GtkWidget* window; // load the dialog from the UI file #if GTK_CHECK_VERSION(3,0,0) GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_GenericInput.ui"); #else GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_GenericInput-2.ui"); #endif // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_GenericInput")); m_wOk = GTK_WIDGET(gtk_builder_get_object(builder, "btOK")); m_wInput = GTK_WIDGET(gtk_builder_get_object(builder, "edInput")); // set the dialog title abiDialogSetTitle(window, "%s", getTitle().utf8_str()); // set the question gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbQuestion"))), getQuestion().utf8_str()); gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbLabel"))), getLabel().utf8_str()); // "enter" in the edit box should trigger the default action gtk_entry_set_activates_default(GTK_ENTRY(m_wInput), true); // connect our signals g_signal_connect(G_OBJECT(m_wInput), "changed", G_CALLBACK(s_text_changed), static_cast<gpointer>(this)); g_signal_connect(G_OBJECT(m_wOk), "clicked", G_CALLBACK(s_ok_clicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return window; }
/** * Ask the user to give an answer to this Question */ void OpenQuestion::ask() { std::cout << "Q : " << getQuestion() << std::endl << "A : "; std::string s; s = input(); setAnswer(s); }
GtkWidget * AP_UnixDialog_GenericInput::_constructWindow(void) { GtkWidget* window; //const XAP_StringSet * pSS = XAP_App::getApp()->getStringSet(); // get the path where our UI file is located std::string ui_path = static_cast<XAP_UnixApp*>(XAP_App::getApp())->getAbiSuiteAppUIDir() + "/ap_UnixDialog_GenericInput.xml"; // load the dialog from the UI file GtkBuilder* builder = gtk_builder_new(); gtk_builder_add_from_file(builder, ui_path.c_str(), NULL); // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_GenericInput")); m_wOk = GTK_WIDGET(gtk_builder_get_object(builder, "btOK")); m_wInput = GTK_WIDGET(gtk_builder_get_object(builder, "edInput")); // set the dialog title abiDialogSetTitle(window, getTitle().utf8_str()); // set the question gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbQuestion"))), getQuestion().utf8_str()); gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbLabel"))), getLabel().utf8_str()); // "enter" in the edit box should trigger the default action gtk_entry_set_activates_default(GTK_ENTRY(m_wInput), true); // connect our signals g_signal_connect(G_OBJECT(m_wInput), "changed", G_CALLBACK(s_text_changed), static_cast<gpointer>(this)); g_signal_connect(G_OBJECT(m_wOk), "clicked", G_CALLBACK(s_ok_clicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return window; }