Rgui - disable right click on plot window? - windows

I've written a routine whereby a user is displayed an image (using grid.raster) and they click on it to define a region of interest (grid.locator).
I added in support for the user to right-click on the plot instead of left-click, which would undo their previously-clicked point.
This works by testing whether grid.locator() returns NULL (from the help file: "If the user did not click mouse button 1, the function (invisibly) returns NULL).
This works fine on Linux, but in Windows using Rgui, right-clicking the plot window brings up a context menu with 'Stop' and 'Continue' and continues waiting for you to click (i.e. the right click is not detected by grid.locator() since it's intercepted for the context menu first).
Is there some way to disable the right click context menu for the plot window in Rgui?
(The user is only going to use Rgui. For the moment I can tell them to use the middle click button to undo instead of right click and this works, but it is moot if they don't have a button with a scroll wheel/middle click button. Alternatively if there's some way I can listen for a keyboard event without having to load a UI package like gtk or tcltk I'm happy for that to happen too).

Related

Firefox: mouse right click triggers left click

I have a weird behavior on firefox. When I righclick anywhere, a click event is fired over the contextual menu that is displayed. (this happens only in the document itself. Not in any menu or bar.
This means (according to my contextual menu at least) that any right click on a link opens the page in an incognito window, and any right click on an empty space triggers "save as"
I have disabled all extensions, but it still happens. For the time being I've resorted to holding right button and then selecting the desired option in the contextual menu.
(PD: I saw a similar question but the behavior is not quite the same)
I have the opposite issue with Firefox/macOS.
When I try to catch a mouseup event and Ctrlis pressed it returns event.button: 2 or event.which: 3. I have not found any post related to it.
Chrome and Safari return 0 as it should be.
I have not figured out why.

How to mouse hover using Blue prism on a web page

I am trying to mouse hover a menu option using blue prism. I tried HTML/Win32/AA/Region mode while spying but none of them worked. If I click on that element, I will be navigated to a different page.
Any pointers will help.
Thanks
Not sure if you still need an answer on that as this question is more than month old.
If I understood you correctly, you want to hover mouse pointer over menu and then select one of the options from the drop down list. If so, there might be some options to achieve that without clicking on the menu itself.
If you want to open same link every time you navigate through this website, then you can launch the target URL instead of navigating through the menu.
Some HTML elements doesn't need to be visible to be active, on some websites you can 'click' on menu item without it being presented in form of drop down list. You can try to spy that element and navigate directly to it. If you won't be able to spy it you can search for correct element in application tree (Application Modeller -> Select some element -> click on arrow next to Identify button -> Open Application Navigator). Then you can use Mouse Click on that element via Navigate stage.
I've tried to imitate mouse hover on some website by spying whole browser window with Win32 mode, and then using Drop option in Navigate stage, giving the menu exact coordinates. Seems to be working, you can try this option as well.
You can test how menu reacts on Focus method in Navigate stage, but I wouldn't get my hopes up with this option.
If you share link to the website, then maybe I'll be able to help more.

How to switch focus to the Inspector tab in Firefox Web Tools?

A button in a website triggers a popup menu when clicked (only when clicked, and not when hovered over). I want to be able to inspect this popup menu but after I right click it and select "Inspect Element", it disappears so I can no longer inspect it.
When the popup menu is displayed, I can see that an entry for it appears in the HTML in the Inspector tab but when I click the entry, the popup menu disappears an so does the HTML entry.
For cases in which a menu appears when a button is hovered over (not clicked) I would click an entry in the Inspector tab to switch focus to it, then I would just hover over the button and use the arrow keys to navigate to the entry in the Inspector tab. But since this button needs to be clicked, then I lose the focus on the Inspector tab.
I thought this could be solved by switching the focus to the Inspector tab in Firefox's Web Tools without clicking anything.
I've tried using different shortcuts such as Ctrl+Shift+C or Ctrl+Shift+I (opens the Web Tool) but I haven't been able to switch the focus to the the Inspector tab to navigate through the HTML after using these shortcuts.
I've also tried using inspect mode (the button left of the Inspector tab), which lets me inspect anything I click. The problem with this method is that to get to the menu I need to click a button first and inspect mode only inspect the first thing I click. Maybe there's a way to ignore the first click while on inspect mode?
EDIT:
Pressing the TAB key numerous times, sometimes focuses on the Inspector tab. Sometimes it just loops through the elements in the website and never focuses on the Inspector tab. Even so, the times I was able to use TAB to focus on the Inspector tab, the popup menu disappeared after pressing TAB about 20 times so I need a different method that doesn't use the TAB key.
I have a deviantart account so I was able to reproduce the issue you described.
The problem is that the popup that appears on click is hidden when the window is blurred or when the page gets clicked. And because focusing the inspector will always cause the content window to blur, there's no way you could switch over to the inspector while keeping the popup displayed.
So, as #Callahad said in a comment, the only viable option here is to use a breakpoint to force the javascript code to pause at a certain point in time that lets you inspect the popup without having it be closed under you.
Now, the question becomes: what is this point in time, and how can you set a breakpoint there.
When the popup appears: this happens when the edit button's element is clicked. If you could add a breakpoint to this exact line in the debugger panel, then you'd be able to click on the edit button, and step through the code until the popup is shown, and then switch over to the inspector again to inspect it. Unfortunately, the javascript event handler for this is in a onclick attribute on the node, and you can't set a breakpoint there.
When the popup is about to be hidden. This happens on window blur. To set a breakpoint there, you could try and follow these steps:
find the html element in the inspector (that's the element where events added to window are shown),
click on the [ev] icon next to it,
find the "blur" event in the list that appears,
click on the debugger icon next to it, this takes you to the debugger at the right line, hopefully
maybe pretty-print the code if needed, using the {} button in the lower left corner of the debugger
add a breakpoint at the right place in this code
and then just click to show the popup, and then click outside the window, this will pause the javascript execution where you added the breakpoint, which is, just before the popup gets hidden, therefore giving you a chance to switch over to the inspector and inspect the popup before it closes.
The popup also gets hidden on page click, so you could do the same thing by looking at this event.
Another valid approach could be:
Override the code that hides popups! Javascript is dynamic, so you could totally turn this to your advantage. Find the function in the deviantart code that hides popup, and change it.
By quickly looking at what was on the window object in the web console, I got lucky and found: Popup2.hideAll. So if you just run this in the web console: Popup2.hideAll = function(){}, and then open the popup, it will just stay there and never get hidden again until you reload the page. This gives you a good way to inspect it.
Last, one very good way to work with DOM changes like this would be to have the "break on DOM mutations" feature in the devtools. Firebug has this, Chrome devtools too, unfortunately Firefox doesn't yet.
The idea of this feature is simple, in the inspector: right click any node (in this case, the parent element of where the popup would appear in the DOM), select "break on mutation", then click to open the popup. When the popup gets inserted into the DOM, devtools would see this and automatically halt javascript execution.

Click on a submenu item in windows

all.
I'm trying to do the following, using standard windows menus. I have a menu with a sub menu attached to it. I need to perform different actions when user clicks the menu item that opens a submenu, and user hovers over the menu item and submenu opens without a click.
As far as I could see WM_MENUCOMMAND is only sent when user clicks on a menu item that does not have a submenu attached. Also no mouse click messages are sent when I actually click an item that contains submenu.
So is this even possible?
Thanks.
I believe you can tell when the mouse moves over an item by watching for WM_MENUSELECT. You would then have to start a timer, and if the timer expires before the cursor moves again, you'd have to manually pop open the submenu. I'm not sure how to accomplish the second part.
And it's pretty non-standard behavior that might confuse users. What are you trying to accomplish? And how do you expect it to work for users with only keyboard access?

Cannot see Selenium logs

I am not able see Selenium LOGs files by clicking the Show log button present in the Selenium rc window after each time my scripts run. Are any settings needed to show the log?
The log window often appears off-screen for me, probably because I have multiple monitors. I get it into view by right-clicking on the window name on the taskbar, selecting "Move" from the context menu, and then using the arrow keys to move it into view. Once it's partly in view, I can drag it anywhere I want using the mouse.

Resources