Feltman collections
Upcoming SlideShare
Loading in...5

Feltman collections






Total Views
Views on SlideShare
Embed Views



1 Embed 1 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Feltman collections Feltman collections Presentation Transcript

  • Collections, Arrays & Iteration Mike Feltman F1 Technologies
  • Agenda Collections in VFP Working with Collections Writing Better Code with Collections Using Collections for Object Manipulation Adding Power to VFP Arrays Collections vs. Arrays Merging Arrays & Collections
  • Who Am I President F1 Technologies since 1990 Co-author Visual FoxExpress Consultant Xbase Developer since dBase III/FoxBase 1987
  • “Objects” Collections in VFP _SCREEN, _VFP, FormSet, DataEnvironment, Toolbar, Container, PageFrame, Page, Grid, Column, CommandGroup, OptionGroup, Container, Custom, Control
  • Other Collections in VFP _VFP  Forms  Projects Project  Files  Servers XMLAdapter  Tables XMLTable  Fields
  • “Pseudo” Collections in VFP _SCREEN.Controls  _SCREEN.Forms Form.Controls  FormSet.Forms Custom.Controls  CommandGroup.Buttons Control.Controls  OptionGroup.Buttons Toolbar.Controls  PageFrame.Pages Container.Controls  Grid.Columns Column.Controls
  • The Collection Class New in VFP 8 Key Properties  Count  KeySort (0-3) Key Methods  Add(eItem, cKey, eBefore, eAfter)  Item(eIndex)  GetKey(eIndex)
  • Iterating Collections FOR lnI = 1 TO loCollection.Count FOR EACH loObject in loCollection FOR EACH loObject in loCollection FOXOBJECT Examples: Iterate1.prg, Iterate2.prg, Iterate3.prg
  • UI Support for Collections Listbox ComboBox Example: CollectionDemo.SCX
  • Writing Better Code with Collections Problem: This.Parent.Page2.txtCompany creates a tightly coupled dependency. Solution: Dynamically retrieved Object references eliminate tight coupling. o=o(…) or o=f(…)
  • Using Collections for Multiple Object Manipulations AC CC WC
  • Returning an Array From within a class method a member array can be used as the return value. A function can return an array by calling a class method that returns an array. Example: aConcact in utility.prg
  • Array Utilities aCompact aConcat aFirst aJoin aLast aReverse aUnique aWithout ArrayDemo.Prg
  • Wrapping an Array in a Collection Fox Data Objects – ADO / LINQ like DataCollection.prg, cDataCollection of cData
  • Conclusion Collections in VFP provide convenient ways to access objects Retrieving object references from collections can make code a lot more flexible and stable VFP has a lot of powerful options available on arrays Collection and array implementations are just different enough that each has their own place.