> Hello all. > > Trying to create a toolbar-like window which should appear initially on the > top-left corner of parent window, I faced a silly problem: I can't get the > screen coordinates of that parent window! > > x() and y() both return -1. (event_x_root() - event_x()) is zero as well as > event_y() (maybe because I'm not calling them in handle() and they are not > initialized). > > I suspect the answer is out there, but can't find it... could you please help? > > Also, I found this: http://www.fltk.org/newsgroups.php?gfltk.general+v:9179 > > but it is for FLTK 1 and I'm using version 2 on Linux. > > Thanks in advance! > Ivan
If you want to have x() and y() initialized (before window is shown() and fltk::run() loop, call Window(X,Y,W,H)). Othervise you can use layout(), and pickup position from there. But beware, layout() will be called twice at window startup; first time will fill x() and y() with random values and second with correct ones (this will be two calls one after one so you will not notice, but probably can have impact on sensitive widgets that does not redraw itself correctly). ...or you can use handle() :) -- Sanel _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk