本文整理汇总了C++中Fl_Input类的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Input类的具体用法?C++ Fl_Input怎么用?C++ Fl_Input使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fl_Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
void WidgetTable::button_cb(Fl_Widget *w, void * p)
{
fprintf(stderr, "BUTTON: %s\n", (const char*)w->label());
WidgetTable * myTable = static_cast<WidgetTable*>(p); //WidgetTable * myTable = (WidgetTable*)(p);
UserInterface * myUserInterface = static_cast<UserInterface*>(myTable->ptr_to_UserInterface); //UserInterface * myUserInterface = (UserInterface*)(myTable->ptr_to_UserInterface);
int myRow = 8, myColumn = 8;
//std::stringstream buffer;
Fl_Widget * myWidget = myTable->GetElement(myRow, myColumn);
Fl_Input * myCell = dynamic_cast<Fl_Input*>(myWidget);
myWidget = myTable->GetElement(myRow, myColumn);
My_fl_button * myFlButton = (My_fl_button*)w;
std::cout << std::endl << myFlButton->x_pos << std::endl;
std::cout << myFlButton->y_pos << std::endl;
myCell = dynamic_cast<Fl_Input*>(myWidget);
myCell->value("try");
myUserInterface->textDisplayString << "button pressed" << std::endl;
myUserInterface->textBuffer->text((myUserInterface->textDisplayString).str().c_str());
myTable->printInTable(6, 6, "text", myTable);
}
示例2: addParameter
void onelabGroup::updateParameter(onelab::string &p)
{
Fl_Tree_Item *n = _tree->find_item(p.getName().c_str());
if(!n) {
addParameter(p);
return;
}
Fl_Group *grp = (Fl_Group *)n->widget();
// macro button
if(p.getAttribute("Macro") == "Gmsh"){
return;
}
// non-editable value FIXME
if(p.getReadOnly()){
Fl_Output *but = (Fl_Output *)grp->child(0);
but->value(p.getValue().c_str());
return;
}
// simple string (no menu)
if(p.getChoices().empty() && p.getKind() != "file"){
Fl_Input *but = (Fl_Input *)grp->child(0);
but->value(p.getValue().c_str());
return;
}
// general string input TODO
Fl_Input_Choice *but = (Fl_Input_Choice *)grp->child(0);
but->value(p.getValue().c_str());
}
示例3: atoi
void ImpressionistUI::cb_setFilterKernalSize(Fl_Widget *o, void *v) {
ImpressionistUI *pUI = (ImpressionistUI*)o->user_data();
int width = atoi(pUI->m_filterWidthInput->value());
int height = atoi(pUI->m_filterHeightInput->value());
if (width <= 0 || height <= 0) {
fl_message("Width or Height cannot be less than 0");
return;
} else {
pUI->m_filterSizeDialog->hide();
pUI->m_nFilterWidth = width;
pUI->m_nFilterHeight = height;
pUI->m_filterKernalDialog = new Fl_Window(60 + 30 * width + 10 * (width - 1), 60 + 30 * width + 10 * (width - 1) + 50, "Filter Kernal");
pUI->m_filterKernalEntries.clear();
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
Fl_Input *filterEntry = new Fl_Input(60 + 30 * i + 10 * i, 30 * j + 10 * j, 30, 30, "");
filterEntry->value("1.0");
pUI->m_filterKernalEntries.push_back(filterEntry);
}
}
pUI->m_applyFilterKernalButton = new Fl_Button(0, 60 + 30 * width + 10 * (width - 1) + 20, 50, 20, "Apply");
pUI->m_applyFilterKernalButton->user_data((void *)(pUI));
pUI->m_applyFilterKernalButton->callback(cb_applyFilterKernal);
pUI->m_filterKernalDialog->end();
pUI->m_filterKernalDialog->show();
}
}
示例4: BrowseColors
static void BrowseColors(Fl_Widget *wdg, void *arg)
{
ProjectOptionsDlg* dlg = (ProjectOptionsDlg*)arg;
Fl_Input *inp = dlg->GetColors();
const char *dir = fl_file_chooser("Colors File", NULL, inp->value());
if (dir)
inp->value(dir);
}
示例5: field_select_file_cb
static void field_select_file_cb(Fl_Widget *w, void *data)
{
Fl_Input *input = (Fl_Input*)data;
int ret = fileChooser(FILE_CHOOSER_SINGLE, "Choose", "", input->value());
if(ret){
input->value(fileChooserGetName(0).c_str());
input->set_changed();
}
}
示例6: button_callback
void button_callback(Fl_Widget* widget, void* data) {
Pair* pair = (Pair *)data;
Fl_Button* button = pair->button;
Fl_Input* input = pair->input;
button->label(input->value());
printf(input->value());
}
示例7: curframe_cb
static void curframe_cb(Fl_Widget *w, void *v) {
Fl_Input *inp = (Fl_Input *)w;
VMDApp *app = (VMDApp *)v;
int val = atoi(inp->value());
int max = app->molecule_numframes(app->molecule_top());
if (val < 0) val = 0;
if (val >= max) val = max-1;
app->animation_set_frame(val);
}
示例8: printInTable
void WidgetTable::printInTable(int row, int col, std::string text, WidgetTable * myWidgetPointer)//this causes trouble
{
WidgetTable * myTable = myWidgetPointer;
Fl_Widget * myWidget = (Fl_Widget*) (myTable->GetElement(row, col));
Fl_Input * myCell = (Fl_Input*)(myWidget);
std::stringstream buffer;
buffer << text;
myCell->value(buffer.str().c_str());
}
示例9: DirectoryChooser
void DirectoryChooser(Fl_Widget *widget, void *text){
Fl_Input *dirfield = (Fl_Input *)text;
char *dir = fl_dir_chooser("Select a directory to use as the startup directory", dirfield->value(), 1);
if(dir==NULL){
return;
}
dirfield->value(dir);
dirfield->do_callback();
}
示例10: ClickedAddWP
static void ClickedAddWP(Fl_Widget * w, void * userdata)
{
WaypointClient* anInstance = (WaypointClient*) userdata;
Fl_Input_Choice * fromWPChoice = anInstance->frWps;
Fl_Input_Choice * toWPChoice = anInstance->toWps;
Fl_Input * theLat = anInstance->latIn;
Fl_Input * theLon = anInstance->lonIn;
Fl_Input * theEle = anInstance->eleIn;
Fl_Input * theName = anInstance->nameIn;
string lat(theLat->value());
string lon(theLon->value());
string ele(theEle->value());
string name(theName->value());
Json::Value wp;
wp["name"] = name;
wp["lat"] = atof(lat.c_str());
wp["lon"] = atof(lon.c_str());
wp["ele"] = atof(ele.c_str());
if (anInstance->addWaypoint(wp) == true)
{
cout << "Added: Waypoint(" << name << "); \n" << endl;
}
else
{
cout << "Error: Waypoint(" << name << ") could not be added! \n" << endl;
}
buildWaypointList(anInstance);
}
示例11: ClickedModifyWP
static void ClickedModifyWP(Fl_Widget * w, void * userdata)
{
WaypointClient* anInstance = (WaypointClient*) userdata;
Fl_Input * theLat = anInstance->latIn;
Fl_Input * theLon = anInstance->lonIn;
Fl_Input * theEle = anInstance->eleIn;
Fl_Input * theName = anInstance->nameIn;
string lat(theLat->value());
string lon(theLon->value());
string ele(theEle->value());
string name(theName->value());
Json::Value wp;
wp["name"] = name.c_str();
wp["lat"] = atof(lat.c_str());
wp["lon"] = atof(lon.c_str());
wp["ele"] = atof(ele.c_str());
anInstance->removeWaypoint(name);
anInstance->addWaypoint(wp);
cout << "Modified: " << name << "(" << lat << ", " << lon << ", " << ele << ", " << name << "); \n" << endl;
buildWaypointList(anInstance);
}
示例12: onelab_connect_remote_server_cb
void onelab_connect_remote_server_cb(Fl_Widget *w, void *data)
{
Fl_Input *serverAddr = (Fl_Input *)data;
std::string address = serverAddr->value();
std::size_t colon = address.find(":");
GmshNetworkClient *c = OnelabDatabase::instance()->useAsNetworkClient(
ip4_inet_pton(address.substr(0, colon).c_str()),
atoi(address.substr(colon+1, address.size()-colon-1).c_str()),
"GUI");
if(c == NULL) {
Msg::Error("Unable to connect ONELAB server (%s)", address.c_str());
Msg::Exit(1);
}
else if(FlGui::available()) // FIXME
c->setCallback(FlGui::instance()->onelab);
}
示例13: onelab_listen_unix_cb
void onelab_listen_unix_cb(Fl_Widget *w, void *data)
{
Fl_Check_Button *checkbutton = (Fl_Check_Button *)w;
Fl_Input *sockUNIX = (Fl_Input *)data;
if(checkbutton->value() == 1) {
sockUNIX->deactivate();
CTX::instance()->onelab.unixSock = sockUNIX->value();
std::size_t colon = CTX::instance()->onelab.unixSock.find(":");
std::ostringstream tmp;
tmp << CTX::instance()->homeDir << CTX::instance()->onelab.unixSock;
OnelabServer::instance()->listenOnUnix(tmp.str().c_str());
}
else {
sockUNIX->activate();
OnelabServer::instance()->stopUnix();
}
}
示例14: onelab_listen_udt_cb
void onelab_listen_udt_cb(Fl_Widget *w, void *data)
{
Fl_Check_Button *checkbutton = (Fl_Check_Button *)w;
Fl_Input *sockUDT = (Fl_Input *)data;
if(checkbutton->value() == 1) {
sockUDT->deactivate();
CTX::instance()->onelab.udtSock = sockUDT->value();
std::size_t colon = CTX::instance()->onelab.udtSock.find(":");
OnelabServer::instance()->listenOnTcp(
ip4_inet_pton(CTX::instance()->onelab.udtSock.substr(0, colon).c_str()),
atoi(CTX::instance()->onelab.udtSock.substr(colon+1, CTX::instance()->onelab.udtSock.size()-colon-1).c_str()));
}
else {
sockUDT->activate();
OnelabServer::instance()->stopUdt();
}
}
示例15: main
int main( int argc, char **argv )
{
Fl_Double_Window *win = new Fl_Double_Window( 100, 100, 400, 300, "Flu_Chat_Buffer_Try" );
Flu_Chat_Buffer *b = new Flu_Chat_Buffer( 0, 0, 400, 200 );
Fl_Input *in = new Fl_Input( 80, 210, 100, 30, "Send:" );
in->when( FL_WHEN_ENTER_KEY_ALWAYS );
in->callback( sendMsg, b );
win->end();
win->resizable( win );
b->addSystemMessage( "System message" );
b->addRemoteMessage( "<Remote User> ", "Remote user's message" );
b->addLocalMessage( "<Local User> ", "Local user's message" );
win->show();
return( Fl::run() );
}