c++ - Update flags for a window -


good morning everyone! trying set , (later) delete flag window in c++. no matter try do, continue compile errors , can't figure out. below relevant bits of the object:

enum {     no_focus        = 0x0001,     click_to_focus      = 0x0002,     no_border       = 0x0004,  ... }  class frame : public fl_window {     int flags_;     void set_flag(int i) {flags_ |= i;}     void clear_flag(int i) {flags_&=~i;}     int flags() const {return flags_;}     int flag(int i) const {return flags_&i;}  ... } 

i trying adjust flags value function:

void showwindow() {  display* d = fl_display;  xwindow w = xcreatesimplewindow(d, rootwindow(d, fl_screen),         0, 0,   100, 200,         0,         0x000000,         0x000000);      frame* frame = new frame(w);  //frame.flags |= no_border;  //frame->flags() |= no_border;  frame->flags(no_border); } 

i have tried other ways commented out parts above, no matter try, continue compile errors. appreciated!

thanks, dave

update:

per information provided, have made set_flag() function public, not getting desired results. function in project checks value of flags before drawing window:

void frame::updateborder() {  ...      if (flag(no_border)) { ... }  else { ... } } 

but doesn't appear when set flag externally, getting triggered. , after adding debug printf statements, can see window being draw before flag can set. how can resolve that? have like:

frame*->set_flag(no_border); frame* frame = new frame(w); 

or

frame* frame; frame->set_flag(no_border); frame = new frame(w); 

i can program compile latter, desired effects still not happening. how can set flag before window drawn?

you need public: before part(s) of class want accessible outside class.

notice ought not make flags_ public, ought not make form usable:

frame.flags_ |= no_border; 

and flags without underscore function, following tried badly wrong:

frame.flags |= no_border; 

you defined flags() read only, when make flags public, can't do:

frame->flags() |= no_border; 

once make correct part of class public, should use defined:

frame->set_flag( no_border ); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -