Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Gil Ben-Zvi on November 17, 2009, 09:32:00 AM

Title: Compound Object Reference
Post by: Gil Ben-Zvi on November 17, 2009, 09:32:00 AM
I am trying to automate the MSWord spell-checker to practice PB 9 new features. I tried to test the compound object reference to combine the following two method calls (to fill a string variable)

     Object Call oSpellingSuggestions.Item(CntEll) To oSpellingSuggestion
     ' Store the 'name' in the string.
     Object Get oSpellingSuggestion.Name To sTemp

into the next single line:

      Object Call oSpellingSuggestions.Item(CntEll).Name To sTemp

but the result is an empty string.

What am I doing wrong here?
Title: Re: Compound Object Reference
Post by: José Roca on November 17, 2009, 03:23:21 PM
 
One instruction needs CALL and the other GET. Maybe PB doesn't like this combination.
Title: Re: Compound Object Reference
Post by: Gil Ben-Zvi on November 17, 2009, 05:43:24 PM
Hi Jose -

I have not seen any remark regarding such call-get combination. Have you tried
compound reference and got good results ?

You are indeed a 'COM Master' - Many thanks for your time.

Gil.
Title: Re: Compound Object Reference
Post by: José Roca on November 18, 2009, 02:22:20 AM
 
I have said maybe. And maybe only in some particular cases. I don't know what code generates the compiler for that instruction and therefore I can't ascertain where is the problem. Only the PB staff can do it.

I don't use the compound syntax very much. I leave it to ex VBer's. Saves typing but you lose clarity and in some cases efficiency. Besides, if you use the compound syntax with direct interface calls and one of the intermediate properties returns a null pointer a GPF is guaranteed.