[Prev][Next][Index][Thread]

Re: Custom gadgets in a frame



Hi Dustin,

On Wed, 19 Apr 2000 21:15:02   Dustin Voss wrote:
>Has anybody run into this problem?
>
>
>define class <my-list-control> (<list-control>) end class;
>
>define frame <my-frame> (<simple-frame>)
>  pane my-list-control (frame)
>    make (<my-list-control>);
>
>  layout (frame)
>    horizontally()
>      frame.my-list-control;
>    end;
>end frame;
>
>begin
>  start-frame (make (<my-frame>));
>end;
>
>
>
>This yields a runtime error:
>
><my-frame> is not an instance of <sheet>
>
>
>Anybody know why this is?  This *severely* limits the extensibility of 
>DUIM.
>
>-- Dustin Voss

This should be in a DUIM FAQ, it is a counterintuitive part of the
DUIM design. Basically, the gadget classes are all abstract, so you
are subclassing a class that isn't a complete implementation. So
typically you would only subclass a gadget to build a completely
new implementation.

There are two ways in which you can effectively subclass gadgets
as you were expecting:

1. Use the module win32-duim, and subclass <win32-list-box>.

  This subclasses the concrete Win32 representation of <list-box>,
  but obviously limits your code to only working on Windows.

2. Use 'define pane' to wrap the list box.

  Something like this (untested):

    define pane <my-list-box> (<list-box>)
      pane inner-list-box (pane)
        make(<list-box>, ...);
      layout (pane)
        vertically ()
          pane.inner-list-box
        end;
    end pane <my-list-box>;

  I think this has been discussed before, so you might be able to
  find more detail in the archives.

I typically find that subclassing a gadget is something you don't
need to do, in languages such as Java you have to do it in order
to add new methods, but in Dylan you can add methods without having
a new class. The whole Functional Developer IDE is written in DUIM,
and we didn't find a need to subclass gadgets.

If you'd like to tell me what you're trying to do, I'd be happy to
offer some advice on how I might solve such a problem.

I hope this helps,

Andy

---
Andy Armstrong
andrewa@functionalobjects.com



Send FREE April Fool's Greetings to your friends!
http://www.whowhere.lycos.com/redirects/American_Greetings.rdct


Follow-Ups: