• Welcome to Theos PowerBasic Museum 2017.

Compound Object Reference

Started by Gil Ben-Zvi, November 17, 2009, 09:32:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gil Ben-Zvi

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?

José Roca

 
One instruction needs CALL and the other GET. Maybe PB doesn't like this combination.

Gil Ben-Zvi

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.

José Roca

 
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.