More than just a ListView

I'm in the middle of writing a courier labelling application. It started as a converter from csv format data from navision into a simple flat file format. The only problem is that while the other two labelling applications both allow a 'number of items' and 'total weight' to be added after reading the feed. This (DOS) application spits the labels straight out, no chance to change stuff. So all of a sudden the convertor gained a GUI and that sort of what this post is about. I had the opportunity to look at how I built a GUI after I had a set of objects already designed and built. Now for a while I have been wrapping listviews so that the 'ExampleDataTypeListView' had a 'ExampleData' property to allow you to assign a collection. This of course refreshes the view and builds the listViewItems and there associated properties. This time however, I also needed to be able to show different views in my list view (a bit like the drop down above outlooks message view). e.g. List of items that need box counts and weight, List of items where everything ok, List for a date range, etc etc. Now in order to get these reduced sets of data, I came up with the idea of a filter class heirarchy. The abstract filter defines methods to convert a data set into a data set where items matched i.e. Data[] matches = Filter.GetMatches(Data[] allData), and also a name property for identifying the filter in a GUI. The instantiated classes then define properties in order to describe what they are looking for (e.g. AddressFilter has a postcode property, DataRangeFilter has a startDate and EndDate), and also override the abstract bool Match(data) function with particular logic. (e.g. if data.date > startDate and data.date < EndDate) But this got me thinking? What is good practice in terms of reusability, design etc, in these sorts of applications. Should I be making these objects more abstract? Should I be looking at something like the listBox/ComboBox idea of adding an object and declaring which fields are shown? Or as in the recent MSN article trying to make designer friendly components?

Add comment

  Country flag


  • Comment
  • Preview
Loading