Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object List
Message
From
22/06/2001 08:45:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/06/2001 07:53:14
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00522334
Message ID:
00522359
Views:
9
>Hello everyone,
>
>It's me again :p
>
>How can I get a list of object in a form? To be more specfic, I want to examine
>whether the user have filled in all the textbox or not when he click the submit
>button.
>I want to have a list of textboxes and then check them on by one.
>
>Thanks a lot!
>Jimi
oCollector = NewObject('udfobjcollector','mycollector.prg')
With oCollector
  .FillCollection(thisform)
  If type(".aCollection[1]") = "L"
    * No members
    Return .f.
  Endif
  For each oObject in .aCollection
    With oObject
      If upper(.Baseclass)='TEXTBOX' and empty(.Value)
        .SetFocus()
        oCollector.ResetCollection()
        exit
      Endif
    Endwith
  Endfor
Endwith

*myCollector.prg
Define CLASS udfobjcollector AS relation
  Name = "udfobjcollector"
  Dimension acollection[1]

*-- Method to fill collection array aCollection with members of all contained objects
  Procedure fillcollection
  Lparameters oContainerObject
  Local ix, nMembers, lnExpand, oObjectRef, aContainerObjects[1]
  nMembers = amembers(aContainerObjects, oContainerObject,2)
  With this
    For ix = 1 to nMembers   && Start collecting
      lnExpand = iif(type(".aCollection[1]")= "L",0,1)
      Dimension .acollection[alen(.aCollection,1)+lnExpand]
      oObjectRef = eval("oContainerObject."+aContainerObjects[ix])
      .acollection[alen(.aCollection,1)] = oObjectRef
      .fillcollection(oObjectRef)  && Recurse
    Endfor
  Endwith
Endproc

*-- Release object references when done with aCollection array
  Procedure resetcollection
  This.acollection=.f.	&& Release Object References
  Dimension this.acollection[1]
Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform