On 30 Mar 2007, at 13:40, Hans George wrote:

> Why does the methode child_of() return a (!)const(!) pointer to the  
> parent Window?
>
> I want to change the position of the parent window, when draging  
> the child window around. So I had the idea to get a pointer to the  
> parent window with the help of the child_of() methode. And with  
> this pointer I could call the position(...) methode of the parent  
> window and my job would be done. But I can`t because of the (!)const 
> (!) pointer (yeah, I could, but that`s not the point).
>
> So can you answer my leading question, that would be great!

You are using fltk-2 I guess? You did not say...

Anyway, child_of() mainly is used to tell the WM that your widget  
*is* a child of another window, e.g. for making modal dialogs and  
etc... For this it is better that the parent window is const, so you  
can not inadvertently change it in some way.

If you just want to get a pointer to your window's parent, you can  
probably either do that by calling parent(), or much better would be  
to explicitly pass a pointer to the parent into your child window  
code, and use that for all manipulation of the main window.


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

Reply via email to