Jose Marcelo Auler wrote:

>> Jose Marcelo Auler wrote:
>>
>> > Hello,
>> > I'm not an advanced user in fluid, and I don't know if I missed some
>> > point, but I couldn't create an Fl_Window by inheritance, only by
>> > composition. And for me, that's bad, because if a want to handle events
>> > I will need to do a subclass of Fl_Window just to forward the events to
>> > my handler class. To make a long story short, is there a way to create
>> > a Fl_Window class in fluid without composition? Thanks in advanced, J.
>> > Marcelo Auler
>>
>> What I do is, create a Widget Class. Then change the "Class" to
>> Fl_Double_Window.
>>
>> Here are the steps I use:
>>
>> 1. Create a function.
>> 2. New->Code->Widget Class
>> 3. Open the properties for the window that appears
>> 4. Go to the C++ tab
>> 5. Enter "Fl_Double_Window" into the "Class" field
>> 6. Enter the name of the class, for example, "MyWindow" in the "Name"
>> field.
>>
>> --
>> Alvin
> 
> It worked!
> Thanks,
> J.Marcelo Auler

One more thing I forgot to mention. If the new window you are making is
spawned by another window (say by pressing a button on your main window),
make sure to add:

parent(0);

in the "Extra Code" section on the "C++" tab in the properties
of "MyWindow". If you don't, the new window will spawn with the main window
as its parent and weird stuff will happen. The "parent(0);" code makes the
MyWindow a top-level window (border, etc.).

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

Reply via email to