Mike Werner wrote:
> Did you use the 'New'->'Code' options of Fluid to generate your example?

        Yes, to implement the constructor and handle() method.
        To make a new function/method with your own code, you:

        a) Use New -> Code -> Function/method  -- creates the function 
prototype/definition
        b) Use New -> Code -> Code             -- creates the code for the 
function/method

        This is how one can implement your own custom functions
        and custom methods for custom classes inside fluid.
        (To make custom classes, see below)

> I cut and paste the code between your 'snip' lines into a text file called 
> 'hover.fl'.
> Then I opened 'hover.fl' with Fluid. That seems to work. Fluid brings up a 
> small window
> with the ATM box inside it. The Fluid code window shows that a class 
> 'MyGroup' has been
> created inside of which there are two items:

        Sounds good so far.

        Be sure you're working with the /second/ example I sent,
        not the first one. Note I replied to myself with a modified version
        of the file.

> 1) something called 'MyGroup' which seems to be derived from FL_Group,

        Yes, that 'something' is a class definition, eg New -> Code -> Class,
        the custom class being "MyGroup", and yes, that new class is setup
        to derive from Fl_Group.

        If you poke around in fluid, you can open the MyGroup class
        and see the two methods defined inside it; MyGroup() [the constructor]
        and handle() [the event handler].

        You should be able to look at this by highlighting the item
        and hitting F1 to see the properties for the class definition,
        which shows how it derives from Fl_Group.


> Next I used Fluid to generate code, resulting in two files:
> 'hover.cxx' and 'hover.h'. Brought those files into a Visual C++ (6.0) 
> workspace
> to compile and run. Ran into problems there. Here's the message ...
> 
> c:\work\work_11\dwss\code\hover\hover.cxx(5) : error C2572: 
> 'MyGroup::MyGroup' : redefinition of default parameter : parameter 5
>         c:\work\work_11\dwss\code\hover\hover.h(10) : see declaration of 
> 'MyGroup::MyGroup'
> 
> Make any sense to you?

        Can you paste the 2 files here; hover.cxx and hover.h?

        The lines in hover.h that define the ctor should look like:

----
public:
  MyGroup(int X,int Y,int W,int H,const char *L=0);
----

        ..and the definition of the constructor in hover.cxx should look like:

----
MyGroup::MyGroup(int X,int Y,int W,int H,const char *L):Fl_Group(X,Y,W,H,L) {
  // empty
}
----

        If yours look different in some way, esp. the 'L' argument,
        it might be an inconsistency with fluid's code generator.

        But be sure you're using the second fluid file I sent,
        ie. the message that starts off saying:

                "Actually, the following .fl file should work better."


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

Reply via email to