Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting fields....
Dean...I created a base class that creates X number of fields. I then derived a new class from that base class. The derived class needs to create 2 more fields. Since I can't override the InitSerial method, what I instead did was to keep the fieldslist persistent in the base class, and then use a method to return that list to my derived class. In the Connect() function, the derived class takes that fields list, adds its two classes and sets those fields.

This ends up working, but the question I have is....1) is there a better way (there almost always is), 2) If the base class already got the field ID for the fields it created (getFieldIdByName()), and then the derived class adds 2 more fields and sets the fields again....are those ID values going to be hosed, or will they ALWAYS be the same ID values? (since the new fields were added to the end of the field list).
1. Just create your own overrideable method. Provide the default implementation in the base class and override it in the derived class. Then just call that method from your InitSerial method. Pass it the vector to fill in.

2. You wouldn't want to set them twice if that could be avoided.
Dean Roddey
Explorans limites defectum
Did that work for you?
Dean Roddey
Explorans limites defectum
Hehe...I didn't get a chance yet. Just got home. But as I does sound like a better way to do it.
Dean Roddey Wrote:Did that work for you?

Ya, Dean, that method works great. Much cleaner too.

Possibly Related Threads…
Thread Author Replies Views Last Post
  setting up CQC tom 12 1,818 10-31-2021, 02:41 PM
Last Post: Dean Roddey
  Setting up SQL Database sic0048 4 1,743 12-27-2018, 05:57 PM
Last Post: Dean Roddey
  Can't add fields to ElkDev driver rbroders 4 2,242 08-07-2018, 06:24 PM
Last Post: Dean Roddey
  Simple check before setting Elk M1 to Arm State KenC 7 5,266 10-03-2017, 05:55 PM
Last Post: Dean Roddey
  Lumagen Radiance fields missing dlmorgan999 14 8,612 02-18-2017, 11:04 AM
Last Post: dlmorgan999
  Field Check Box fields George M 2 2,438 01-25-2017, 04:14 PM
Last Post: George M
  Cant use fields of Denon driver in global actions George M 4 3,946 12-18-2016, 06:21 PM
Last Post: Dean Roddey
  How do I 'count' fields? jkmonroe 37 13,768 08-02-2016, 06:27 PM
Last Post: jkmonroe
  Persistent Fields Ron Haley 1 1,694 05-06-2016, 03:31 PM
Last Post: Ron Haley
  Logic Server Fields Limit zra 11 5,563 03-20-2016, 07:59 AM
Last Post: zra

Forum Jump:

Users browsing this thread: 1 Guest(s)