0
Collections, Arrays & Iteration          Mike Feltman         F1 Technologies
Agenda   Collections in VFP   Working with Collections   Writing Better Code with Collections   Using Collections for ...
Who Am I   President F1 Technologies since 1990   Co-author Visual FoxExpress   Consultant   Xbase Developer since dBa...
“Objects” Collections in VFP   _SCREEN, _VFP, FormSet,    DataEnvironment, Toolbar, Container,    PageFrame, Page, Grid, ...
Other Collections in VFP   _VFP       Forms       Projects   Project       Files       Servers   XMLAdapter       ...
“Pseudo” Collections in VFP   _SCREEN.Controls        _SCREEN.Forms   Form.Controls           FormSet.Forms   Custom....
The Collection Class   New in VFP 8   Key Properties       Count       KeySort (0-3)   Key Methods       Add(eItem, ...
Iterating Collections   FOR lnI = 1 TO loCollection.Count   FOR EACH loObject in loCollection   FOR EACH loObject in lo...
UI Support for Collections   Listbox   ComboBox   Example: CollectionDemo.SCX
Writing Better Code with               Collections   Problem: This.Parent.Page2.txtCompany    creates a tightly coupled d...
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 retu...
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 collect...
Upcoming SlideShare
Loading in...5
×

Feltman collections

210

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
210
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Feltman collections"

  1. 1. Collections, Arrays & Iteration Mike Feltman F1 Technologies
  2. 2. 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
  3. 3. Who Am I President F1 Technologies since 1990 Co-author Visual FoxExpress Consultant Xbase Developer since dBase III/FoxBase 1987
  4. 4. “Objects” Collections in VFP _SCREEN, _VFP, FormSet, DataEnvironment, Toolbar, Container, PageFrame, Page, Grid, Column, CommandGroup, OptionGroup, Container, Custom, Control
  5. 5. Other Collections in VFP _VFP  Forms  Projects Project  Files  Servers XMLAdapter  Tables XMLTable  Fields
  6. 6. “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
  7. 7. The Collection Class New in VFP 8 Key Properties  Count  KeySort (0-3) Key Methods  Add(eItem, cKey, eBefore, eAfter)  Item(eIndex)  GetKey(eIndex)
  8. 8. 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
  9. 9. UI Support for Collections Listbox ComboBox Example: CollectionDemo.SCX
  10. 10. 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(…)
  11. 11. Using Collections for Multiple Object Manipulations AC CC WC
  12. 12. 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
  13. 13. Array Utilities aCompact aConcat aFirst aJoin aLast aReverse aUnique aWithout ArrayDemo.Prg
  14. 14. Wrapping an Array in a Collection Fox Data Objects – ADO / LINQ like DataCollection.prg, cDataCollection of cData
  15. 15. 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.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×