Can anyone advise me in this question, please?

Many thanks in advance

Oliveiros
----- Original Message ----- From: "Oliveiros Cristina" <[EMAIL PROTECTED]> To: "Christian Biesinger" <[EMAIL PROTECTED]>; <[email protected]>
Sent: Friday, July 07, 2006 7:18 PM
Subject: Re: How to pass values in XPCOM back to JS


Thank you for your e-mail, Christian.

I've already fixed it using the [retval] attribute and I was able to retrieve the string from my xpcom component

But another problem surfaces.

I can explain what I need.
I need to affect the value of a <label> overlay element on my extension with a string obtained from component.

I've tried to do it with this in js

label = document.getElementById("user_name_label");

label.value = data;

But the problem is when should I call this statements. they work but only when the browser is already displayed.



If I use these instructions before nothing changes on label.

Is there any event I can trap to place this instructions on?

I guess label doesnt have events

Thanks in advance



Cheers,

Oliveiros




----- Original Message ----- From: "Christian Biesinger" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, July 07, 2006 6:30 PM
Subject: Re: How to pass values in XPCOM back to JS


Oliveiros Cristina wrote:
void ObtainUser(out string str_user_name);

If you instead defined it as:
  string Obtainuser();
Then it'd be a function with no arguments in JS that just returns the
string.

I've tried to call the function with one arguments, but I get an exception like this :

Erro: uncaught exception: [Exception... "'Out' argument must be an object arg 0 [nsIFoxPanel.ObtainUser]" nsresult: "0x80570002 (NS_ERROR_XPC_NEED_OUT_OBJECT)" location: "JS frame :: chrome://extensao/content/foxpanel.js :: <TOP_LEVEL> :: line 34" data: no]

I don't know what your argument was but out params works like this:

  var outval = {};
  panel.ObtainUser(outval);
  // Now use outval.value

But I'd suggest you use the IDL syntax I suggested above and do:
  var yourstring = panel.ObtainUser();

--
All the world's a stage,
And all the men and women merely players:
They have their exits and their entrances;
And one man in his time plays many parts, [...]     --W. Shakespeare
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to