Re: Some issues calling atk methods II



 API,

One thing: In JavaScript, one invokes a constructor with the 'new' operator. That is:
let x = new Atk.Relation(...);

not:
let x = Atk.Relation.new(...);

Other than that, I don't have a definitive answer. I tried a few things, and have some clues, but it doesn't look like things are working properly. Here is what I did:

const Atk = imports.gi.Atk;
<skip>
let stLabel = new St.Label({ text: "ForAPI" });
log('new St.Label():  ' + stLabel);
let accLabel = stLabel.get_accessible();
log('accLabel.get_role(): ' + accLabel.get_role());
let accRelation = new Atk.Relation(accLabel, 1, Atk.RelationType.LABELLED_BY);
log('accRelation.get_relation_type(): ' +  accRelation.get_relation_type());

The log output was:
JS LOG: new St.Label():  [0x8ebdad0 StLabel ("ForAPI")]
JS LOG: accLabel.get_role():  66
JS LOG: accRelation.get_relation_type(): 0

I *think* 66 is ATK_ROLE_TOOL_TIP.  Is that what it should be?

In order to avoid a crash when invoking 'new Atk.Relation(...)', I didn't pass an array, but passed the accessible itself, with a count of one. Why that works doesn't make much sense to me, though.

Also, the Atk.Relation that is returned has the wrong relation type. It's zero (= no relation), but it should be 4 (= labelled-by).

As I said, no definitive answer; just clues to a puzzle.

--
;;;;joseph

'Clown control to Mao Tse Tung.'
 - D. Bowie (misheard lyric) -



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]