Coming back to this "FORCE_POSITION problem" ...

Greg Ercolano wrote:

>>>> c:\fltk-1.3.x-r6960\src\Fl_win32.cxx(1477) : error C2248: 'FORCE_POSITION' 
>>>> : cannot access protected enumerator declared in class 'Fl_Widget'
>>>>         ../..\FL/Fl_Widget.H(151) : see declaration of 'FORCE_POSITION'
>>>>         ../..\FL/Fl_Widget.H(91) : see declaration of 'Fl_Widget'
> 
>> Somewhere in the Fl_Widget.H there is:
>>    friend class Fl_Group;
> 
>       I think that error line in Fl_win32.cxx is part of Fl_X::make()'s 
> definition,
>       so not sure how the "friend class Fl_Group" would help..?

Sure, without looking at the code I thought that it had something
to do with Fl_Window, which is derived from Fl_Group, and thus
should be able to access Fl_Widget's definition (right?). But
here it is Fl_X, and that's another story.

> --- snip
> 1375: Fl_X* Fl_X::make(Fl_Window* w) {
> 1376:  Fl_Group::current(0); // get rid of very common user bug: forgot end()
> [..]
> 1477:    if (!(w->flags() & Fl_Widget::FORCE_POSITION)) {
> 1478:      xp = yp = CW_USEDEFAULT;
> 1479:    } else {
> --- snip

Looking closer at this: the previous (and still FLTK 1.1) code
used Fl_Window::FORCE_POSITION, and this particular flag was
indeed declared in the class Fl_Window, but now it is declared
in Fl_Widget (and thus Matthias changed this when he consolidated
all the flag bits in Fl_Widget).

Now, there's a declaration

   friend class Fl_X;

in FL/Fl_Window.H (line #58), thus class Fl_X should be able to
access Fl_Window's protected (and also private?) declarations,
and Fl_Window can access Fl_Widget's declaration (because it's
an Fl_Group). Tricky, but ... is that right? If yes, this
explains why other compilers don't complain.

Greg (or Matt, since you have VC 2008 Express installed now),
could one of you please test if it works with

     if (!(w->flags() & Fl_Window::FORCE_POSITION)) {

in Fl_win32.cxx, line 1477 (s/Fl_Widget::/Fl_Window::/) ?

I tested it with gcc (cygwin), and it works. If this
works, there is still the question, why doesn't it work
with Fl_Widget::FORCE_POSITION, but that's beyond my
knowledge of c++ rules (and obviously interpreted
differently by MS and other (gnu) compiler writers ;-) ).

Last question: if it works, what would be the solution
for the problem?

  (a) use this (Fl_Window::FORCE_POSITION) or
  (b) make the Fl_Widget::flags enum public

Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to