Hello all,

 Since I have to place a Fl_File_Chooser somewhere on a second monitor,
it's the time for dealing with position issue. Some search on fltk.org
told me the position issue has been happily solved in fltk 2.0 by a new
show(int x, int y) method (http://www.fltk.org/str.php?L226).
 Unfortunately, I use 1.1.7 or 1.1.8 version and there is little chance
to shift to fltk2 in near future. Is there any new wiser trick to cope
with the Fl_File_Chooser position issue in this versions of fltk?

 On the forums I found only one code-providing answer, that is...
http://www.fltk.org/newsgroups.php?gfltk.general+v:11372
 I tried to implement it on my app with the code

[myapp.h]
----------------------------------------------
class File_Picker : public Fl_File_Chooser {
  private: Fl_Window *_win;
  private: Fl_File_Input *_in;
public:
  File_Picker(const char *d, const char *p, int t, const char *title) ;
  ~File_Picker();
  void show();
  void position(int x, int y);
  int x();
  int y();
};
----------------------------------------------

[myapp.cxx]
----------------------------------------------
File_Picker::File_Picker(const char *d, const char *p, int t, const char 
*title) : Fl_File_Chooser(d, p, t, title) {
  //// This code implements a derived Fl_File_Chooser class
//// whose screen position can be controled
_win = dynamic_cast<Fl_Window*>(newButton->parent()->parent());
_in = dynamic_cast<Fl_File_Input 
*>(previewButton->parent()->parent()->resizable());
}

File_Picker::~File_Picker() {
}

void File_Picker::show() {
  if(_win){
  _win->show();
  if(_in) _in->take_focus();
  else _win->take_focus();
}

else Fl_File_Chooser::show();
}

void File_Picker::position(int x, int y) {
  if(_win) _win->position(x,y);
}

int File_Picker::x() {
  if(_win) return _win->x();
else return 100;
}

int File_Picker::y() {
  if(_win) return _win->y();
else return 100;
}
----------------------------------------------

 All seems ok, but if I try to substitute in myapp.cxx the original
declaration "static Fl_File_Chooser *my_chooser = NULL;" with
"static Fl_Picker *my_chooser = NULL;" the code miserably fails the
g++ test with "error: expected initializer before ‘*’ token", while
a simpler "Fl_Picker *my_chooser = NULL;" gives just a slightly
different... "error: expected constructor, destructor, or type
conversion before ‘*’ token". on the same line. Did I get something
wrong? Thank you for your answers.

  Z.B.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to