FLTK logo

[fltk.general] HOWTO = ???->show() in a callback function

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

HOWTO = ???->show() in a callback function roger tunnicliffe Sep 23, 2022  
 
Not sure how the code below comes across but if any one could help I would appreciate it. Just cannot figure out how to do this (not a C++ programmer).
My main() shows window1. A click on a button invokes but1_Callback which creates window2 that has built a menu and some tabs. The tabs are hidden and when you select a menu option it calls ShowCards() where I want to be able to cards->show. I get a "cards was not declared in this scope" error from g++.

int main(int argc, char **argv) {
     Fl_Window *window1 = new Fl_Window(200,200,"Roger's Window");
            Fl_Radio_Round_Button *but1 = new Fl_Radio_Round_Button(x+15, y+1*20, 70, 15, "SYSTEM");
                but1->callback(but1_Callback);
    window1->show();
.
.
void but1_Callback(Fl_Widget *w, void *data) {
  Fl_Window *window2 = new Fl_Window(625, 450);
       Fl_Menu_Bar *rog = new Fl_Menu_Bar(0, 0, 625, 25);
           rog->menu(menu_items);
        Fl_Tabs *cards = new Fl_Tabs(40,40,300,200);
    cards->hide();
    window2->show();
.
.
Fl_Menu_Item menu_items[] =
{
    {"GeneralJournal",    0,                    0,    0,    FL_SUBMENU,                (uchar)FL_NORMAL_LABEL, 0, 10, FL_YELLOW},
        {"Open",                    FL_ALT+'o',    showCards,    0,    0,             0,                         FL_ITALIC,    10, FL_YELLOW},
        {"Save",                    FL_ALT+'s',    0,    0,    0,                                0,                                         0,    10, FL_YELLOW},
        {"Cancel",                FL_ALT+'a',    0,    0,    FL_MENU_DIVIDER,    0,                                      0,    10, FL_YELLOW},
        {"Exit",                    FL_ALT+'x',    0,    0,    0,                                0,                                            0,    10, FL_YELLOW},
        {0},                                                      
    {0,0,0,0,0,0,0,0,0}
};
.
.
void showCards(Fl_Widget *w, void *data)
{
//    cards->show();
    cout << "How do you show cards" << endl;
}

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/ed0e4e50-0b61-4936-b3bd-00405dfcef3en%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.