Re: [Project_owners] Display right-click context menu programmatically

2007-07-09 Thread Todd Long

On 7/9/07, Michael Vincent van Rantwijk, MultiZilla <
[EMAIL PROTECTED]> wrote:



0, 0?  have you tried to change it (because it must be in the browser
area).



Yes, I've tried positioning it where the actual mouse-click takes place with
the same results. Thanks.


On 7/9/07, Neil < [EMAIL PROTECTED]> wrote:



The internal popup code does all sorts of other stuff before actually
calling showPopup. In particular, it sets document.popupNode,
document.popupRangeParent and document.popupRangeOffset, of which the
latter two are apparently needed for spellchecking. Although you can set
document.popupNode through script the other two are readonly so you
appear to be out of luck.



Right, I was hoping there was some way to initialize the popupRange
properties. Perhaps I can initialize the spell checker interface within the
event so that it initializes those properties. I'll look into that but it
might require a native call. Thanks for the info.


On 7/9/07, Michael Vincent van Rantwijk, MultiZilla <[EMAIL PROTECTED]

wrote:


What? showPopup() can no longer be used from JS in Mozilla Firefox?  Or
do you mean in this specific case; where someone wants to use
showPopup() to open the context menu?



Just in the case where spell checker is involved (it appears).


On 7/9/07, Neil <[EMAIL PROTECTED]> wrote:



Yes, I believe the browser content area context menu that includes spell
checking requires a "native" popup event.



Yeah, I think you're are right about the spell checker being the culprit.
Perhaps there is a way to invoke the spell checker interface from the event.


On 7/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:



How about simulating a right-click mousedown/up event?

http://developer.mozilla.org/en/docs/Code_snippets:Miscellaneous#Simulating_mouse_and_key_Events



Thanks for the link but unfortunately that code only applies to Firefox 3 /
Gecko 1.9. There just might not be a way to do it with the latest Firefox /
Gecko release but I'll look into coding for the future Gecko 1.9. Thanks
again.

If anyone else has any ideas they would be greatly appreciated. Thanks very
much for all the replies so far and info.

- TL

--
longfocus at gmail dot com
http://www.longfocus.com
___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners


Re: [Project_owners] Display right-click context menu programmatically

2007-07-09 Thread eric . jung
>>The internal popup code does all sorts of other stuff before actually 

calling showPopup. In particular, it sets document.popupNode, 
document.popupRangeParent and document.popupRangeOffset, of which the 
latter two are apparently needed for spellchecking. Although you can set 
document.popupNode through script the other two are readonly so you 
appear to be out of luck.<<



How about simulating a right-click mousedown/up event?
http://developer.mozilla.org/en/docs/Code_snippets:Miscellaneous#Simulating_mouse_and_key_Events


Eric Jung
FoxyProxy extension author
PasswordMaker extension author
mozdev board 


___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners


Re: [Project_owners] Display right-click context menu programmatically

2007-07-09 Thread Neil
Michael Vincent van Rantwijk, MultiZilla wrote:

> Or do you mean in this specific case; where someone wants to use 
> showPopup() to open the context menu?

Yes, I believe the browser content area context menu that includes spell 
checking requires a "native" popup event.
___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners


Re: [Project_owners] Display right-click context menu programmatically

2007-07-09 Thread Michael Vincent van Rantwijk, MultiZilla
Neil wrote:
> Todd Long wrote:
> 
>> I'm having trouble trying to display the right-click context menu 
>> programmatically (without having to actually right-click). I continue 
>> to get an exception (see below) that I can't seem to get around and 
>> was hoping someone else might have a better idea/solution. What I've 
>> done is setup a window event listener for "click" that executes my 
>> code below. I'm checking for the left mouse button before attempting 
>> to show the right-click context menu (popup). Any suggestions/help 
>> would be great.
> 
> The internal popup code does all sorts of other stuff before actually 
> calling showPopup. In particular, it sets document.popupNode, 
> document.popupRangeParent and document.popupRangeOffset, of which the 
> latter two are apparently needed for spellchecking. Although you can set 
> document.popupNode through script the other two are readonly so you 
> appear to be out of luck.

What? showPopup() can no longer be used from JS in Mozilla Firefox?  Or 
do you mean in this specific case; where someone wants to use 
showPopup() to open the context menu?

-- 
Michael Vincent van Rantwijk
- MultiZilla Project Team Lead
- XUL Boot Camp Staff member
- iPhone Application Developer

___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners


Re: [Project_owners] Display right-click context menu programmatically

2007-07-09 Thread Neil
Todd Long wrote:

> I'm having trouble trying to display the right-click context menu 
> programmatically (without having to actually right-click). I continue 
> to get an exception (see below) that I can't seem to get around and 
> was hoping someone else might have a better idea/solution. What I've 
> done is setup a window event listener for "click" that executes my 
> code below. I'm checking for the left mouse button before attempting 
> to show the right-click context menu (popup). Any suggestions/help 
> would be great.

The internal popup code does all sorts of other stuff before actually 
calling showPopup. In particular, it sets document.popupNode, 
document.popupRangeParent and document.popupRangeOffset, of which the 
latter two are apparently needed for spellchecking. Although you can set 
document.popupNode through script the other two are readonly so you 
appear to be out of luck.
___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners


Re: [Project_owners] Display right-click context menu programmatically

2007-07-09 Thread Michael Vincent van Rantwijk, MultiZilla
Todd Long wrote:
> Hey All,
> 
> I'm having trouble trying to display the right-click context menu
> programmatically (without having to actually right-click). I continue to 
> get
> an exception (see below) that I can't seem to get around and was hoping
> someone else might have a better idea/solution. What I've done is setup a
> window event listener for "click" that executes my code below. I'm checking
> for the left mouse button before attempting to show the right-click context
> menu (popup). Any suggestions/help would be great. Thanks.
> 
> Code
> window.addEventListener("click", doitfunc, false);
> 
> function doitfunc(aEvent) {
>  if (aEvent.button == 0) {
>var context = document.getElementById("contentAreaContextMenu");
>context.showPopup(document.documentElement, 0, 0, "popup", null, null);
>  }
> }

0, 0?  have you tried to change it (because it must be in the browser area).

> Exception
> Error: [Exception... "Component returned failure code: 0x8000
> (NS_ERROR_UNEXPECTED)
> [nsIDOMXULDocument_MOZILLA_1_8_BRANCH.popupRangeParent]"  nsresult:
> "0x8000 (NS_ERROR_UNEXPECTED)"  location: "JS frame ::
> chrome://browser/content/browser.js :: anonymous :: line 3932"  data: no]
> Source File: chrome://browser/content/browser.js
> Line: 3932
> 
> I'm using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4)
> Gecko/20070515 Firefox/2.0.0.4
> 


___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners


[Project_owners] Display right-click context menu programmatically

2007-07-08 Thread Todd Long

Hey All,

I'm having trouble trying to display the right-click context menu
programmatically (without having to actually right-click). I continue to get
an exception (see below) that I can't seem to get around and was hoping
someone else might have a better idea/solution. What I've done is setup a
window event listener for "click" that executes my code below. I'm checking
for the left mouse button before attempting to show the right-click context
menu (popup). Any suggestions/help would be great. Thanks.

Code
window.addEventListener("click", doitfunc, false);

function doitfunc(aEvent) {
 if (aEvent.button == 0) {
   var context = document.getElementById("contentAreaContextMenu");
   context.showPopup(document.documentElement, 0, 0, "popup", null, null);
 }
}

Exception
Error: [Exception... "Component returned failure code: 0x8000
(NS_ERROR_UNEXPECTED)
[nsIDOMXULDocument_MOZILLA_1_8_BRANCH.popupRangeParent]"  nsresult:
"0x8000 (NS_ERROR_UNEXPECTED)"  location: "JS frame ::
chrome://browser/content/browser.js :: anonymous :: line 3932"  data: no]
Source File: chrome://browser/content/browser.js
Line: 3932

I'm using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4)
Gecko/20070515 Firefox/2.0.0.4

--
longfocus at gmail dot com
http://www.longfocus.com
___
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners