Author Topic: classes in Slick-C and classes as class member variables  (Read 1430 times)

shadowbane

  • Community Member
  • Posts: 85
  • Hero Points: 4
classes in Slick-C and classes as class member variables
« on: January 29, 2013, 10:13:53 pm »
Working on some macros today I ran across what i am fairly sure is a bug.  I have a class (tjc.TempEditor), which is derived from sc.editor.TempEditor and implements sc.lang.IIterable, in order to easily iterate across the lines of a temp buffer.  Now I also have a class (tjc.EditorIterator) which implements sc.lang.IIterable to iterate across the lines of any buffer.  In implementing tjc.TempEditor, I wanted to use tjc.EditorIterator, so I did something like this:

class TempEditor : sc.lang.IIterable
{
  private EditorIterator m_iterator;
  public typeless _nextel(typeless& inter){ return m_iterator._nextel(inter); }
  ...
}

as well as overriding open() to tell the iterator the window id of the temp buffer to iterate across.  Interestingly, any references to m_iterator throw a slick-c error.  It appears that m_iterator is invalid.  My first reference to it looks like:
      m_iterator.setWindowID( id );
Which is in the overridden open() method.  It says I have an "Invalid Object Handle".  Now that method is a dead simple assigner to assign a member variable of m_iterator, and that's it.

So are objects embedded as members of other objects not supported, or do I need to do something in my constructor to initialize the thing?

PS. Am I the only person trying to use the class support in slick-C?  It doesn't seem well exercised if things like this don't work (I also have had issues with inheritance, for example, if a class inherits from another which implements an interface, the new class isn't considered as implementing the same interface, so you have to override all the interface methods and call the base class versions before your new class will support the interface)