[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference marin::forte-ft

Title:Forte' Field Test Conference
Notice:Forte R3 is due in summer...with lots of NEW features
Moderator:MARIN::ARVIND
Created:Wed Aug 04 1993
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:919
Total number of notes:3356

919.0. "How to cycle through an OLE collection?" by NSIC01::KLERK (Thunderbirds are Go) Wed Jun 04 1997 10:54

  If you use an OLE object that has a collection property, you can
  usually find methods like GetFirst, GetNext, GetLast to cycle through
  the collection items. After the last item, the method returns "Nothing"
  (in terms of VB) or NIL (VC++). I don't seem to find this condition
  in Forte. How to test on this return value?

  Example: MAPI allows access to your E-mail. You can open your Inbox and
  this Folder object has a Messages collection of 0-n messages:

  In VB you would write something like:
     dim mailMessages as Object
     dim Message as object
     
     set mailMessages = mailInbox.Messages
     set Message = mailMessages.GetFirst()
     while not Message Is Nothing
        set Message = mailMessages.GetNext()
     wend

  In Forte the same would be (importing the MAPI project made through olegen):
     
     mailMessages : MAPI.Messages = new;
     Message      : MAPI.Message = new;

     -- set object reference to Messages collection of Inbox
     mailMessages.SetDispatchObject (VariantRef = mailInbox.Messages);

     -- set object reference to first message in Messages collection
     Message.SetDispatchObject  (VariantRef = mailMessages.GetFirst());

     -- loop through all messages in collection
     while Message.????????? do   -- <<< how to check for Nothing?
         Message.SetDispatchObject(VariantRef = mailMessages.GetNext());
     end while;

  I tried Message.ObjectReference = Nil and even mailMessage = nil
  but both to no avail.

  What does "Nothing" translate into in Forte and where is it stored in the
  CDispatch object that invokes the SetDispatchObject method?

  Theo
      
T.RTitleUserPersonal
Name
DateLines