Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Classes to represent a list/viewbox?

This topic is 6106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Suppose I have a dialog with 4 separate list/view boxes. What would be a good way to manage each box, with 1 class, or by their own classes? (some of the list/view boxes are of similar function). i hope that is clear. ~ I''''m a wannabe programmer ~

Share this post

Link to post
Share on other sites
You''ve hit on one of the fundamental design questions of OO programming. The issue of specialization/generalization is a tough one, and one that requires both academic study and real experience.

Essentially, you have to decide if the generalization of object behavior is worth the extra effort. The answer depends on how much useful generalization can be done in the class. Having a reuseable class that serves only one specific case is not a good use of your time.

The trick is to identify ''patterns'' in your usages. These patterns can be then generalized so that they can be easily reused in other situations. Once you''ve identified the reuse, spending the time to create a useful, reusable class is well worth it.

Sometimes, you work your way backwards. You write some code, and only later realize you should have generalized it for use in other situations. That''s ok; it''s part of the learning process, and the almost ''art'' of OO design. There''s a good book on OO Design Patterns; unfortunately, I don''t have it in front of me and can''t seem to pull it out of the old memory banks. Maybe someone here knows the book I''m referring to...

Btw: for all of our English readers, please substitute ''s'' for all the ''z''s (zed, if you must) :O

Share this post

Link to post
Share on other sites
ok, cool.
i am leaning towards created a separate class since i think i''ll be using it for other things as well.

Now I have another question.
I posted this question as a separate thread just a minute ago, but I will ask you this for the sake of asking you "directly."

Using my last example (a dialog with 4 listboxes), I''m trying to display files from a certain directory into one of those listboxes.

The problem: I''ve tried several ways and it wont show up.
Im using DlgDirList(). I can display one string at a time, but i would like to display everything at one time.

I am also calling the function within OnInitDialog().
My class I am using is derived from CDialog.

Could you help me with this one? It''s been keeping my thinking, with no success...and that naturally bothers me!

Side Note: Odd thing is that when i call DlgDirList() anywhere but OnInitDialog(), it crashes! Do you know why this is the case?

~ I''''m a wannabe programmer ~

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!