Hold-Hover drop down menu Delay Time - menu

Im creating a drop down menu and i want to know if there is anyway to implement the following:
I need to keep the sub-menu open for like 1 sec if the user moves the mouse away from the tab he selected. Much likely like in current intel web page www.intel.com , here u hover over menu, but if u take the mouse away from the tab or the sub-menu is opens it takes a few to hide the sub menu.
Im using .mouseover from jquery to show the menu (a div) but i cant find a way to make it stay for a few moments.
Thanks in advance

This may be of service
What is the JavaScript version of sleep()?
If you want to do something in the interim setTimeout() takes the arguments as shown where continue execution is another subroutine. If you just want this one tab to work this way have mouseover call doStuff and set a boolean (e.g. mouseStillIn) to TRUE. When the mouse exits set this boolean to FALSE, call a recursive function everytime mouseStillIn is TRUE.
e.g.
var mouseStillIn : boolean = false;
function MouseIn()
{
mouseStillIn=true;
CheckMouse();
}
function CheckMouse()
{
if(mouseStillIn)
{
setTimeout(CheckMouse, 1000);
}
}
function MouseOut()
{
mouseStillIn=false;
}

Related

Need help in GMS2 pls, trigger works again and save menu opens again, even though it should just close

I've run into this problem.
I have a save menu with two options: "Save" and "Return", which is selected by the option heart. When selecting the "Return" option, the option arrow going back to "Save" even though it should close the save menu(It seems that when menu is closing, the trigger works again and menu opens again, even though it should just close).
The second problem is that when you select the "Save" option, the "File saved" window appears, after which it does not disappear when im pressing "Z" key, and I do not understand what is the reason for these two errors, no matter how I tried to fix them.
It seems that I write the code correctly, but nevertheless it does not work.
Key Press "Z" Event:
if image_index = 0
{
instance_change(obj_saveconfirm, true);
audio_play_sound(snd_save, 10, false);
}
else {
if image_index = 1
{
instance_destroy();
}
}
Code that opens the save menu:
if place_meeting(x, y, obj_player) && keyboard_check_pressed(ord("Z")) && !instance_exists(obj_savemenu) && !instance_exists(obj_saveconfirm)
{
instance_create_depth(x, y, -9999, obj\_savemenu);
}
It seems that I write the code correctly, but nevertheless it does not work.
I also used "keyboard_check_released" in code that opens the save menu, and menu is closing, but after half a second it opens again.

click on button which appears sometime on screen using python selenium

I am working automating website which generates quotations for mixer selection, sometimes for some parameters list of mixers suggested is more than 5 then Next button appears below the list. This button shown on the screen only when mixer list is more than 5.
below code I am using to save screenshot of the page and I want to screenshot of page which will come after click on Next button whenever it is available.
name = str(worksheet.cell_value(1,1))+"_"+str(worksheet.cell_value(1,2))+"_"+str(worksheet.cell_value(1,3))+\
"_"+str(worksheet.cell_value(1,4))+str(worksheet.cell_value(1,5))+".png"
driver.save_screenshot("D:\Automation\Pycharm_project\MRMix\Screenshots\%s"%name)
Lets say if next button is displayed, then need to click on it and need to take screenshot. You can simply try like below (in java)
you can have small method to return true or false depends on next button display
boolean isNextDisplay=false;
try {
if(driver.findElement(By.id("nextButton")).isDisplayed()==true) {
isNextDisplay=true;
}
}catch (Exception e) {
System.out.println("next button not displayed");
}
depends on display, click on next button and take screenshot.
if(isNextDisplay==true) {
//click on next button
//take screenshot
}
instead of methods, you can straightway write it. in Try >>If >> click and take screenshot

compute Visible property for a button, based upon length of a textarea field

I would like to calculate the visibility of a button based upon the content of a text area field (multi line edit box). it should contain at least some text.
I could use the onkeypress event (server) and perform a partial refresh on the button BUT I notice that the partial refresh spinner appears then when users are writing in the field. I would like to avoid this.
What options do I have?
You would be best off writing a client side script for that event. This script should show the button when there are more than 200 characters in the textarea. You will need to set the style visibility to hidden for the button initially. If the form can be edited multiple times, you will need to write this as a function and call it on page load as well as in the keypress event.
If you can use the keyup event instead of keypress, this may be better.
var textareaID = '#{id:textareaID}';
var buttonID = '#{id:buttonID}';
var textareaValue = document.getElementById(textareaID).value;
var visibility;
if (textareaValue.length > 200) {
visibility = 'visible';
}
else
{
visibility = 'hidden';
}
document.getElementById(buttonID).style.visibility=visibility;

PixiJS - Not all touchend events triggering (outside of displayObject)

Pixijs (3.0.8) supports multi-touch as shown in their demos, and I've set up start, move and end listeners for touches on my mobile device.
The touches are registered on a square within the canvas which I'll call the interactiveArea, but the touchend events trigger when let go outside of the area as well. This is behavior that works fine with a single mouse cursor.
However, when using more fingers, having touches with the identifiers 0,1 and 2, only the first touchEnd is triggered outside of the area.
So I press and hold 3 fingers inside the interactiveArea and move them all outside of it. Then I let go of 1, and then the others. I won't be notified of touchEnds for event 0 and 2, and I'd have to re-register 3 touches and let go properly just to get a touchend for 2 triggered!
Any tips on how I can detect all touchends, rather than have it stop on the first touchend? I've tried working with a setTimeout hack as well, but that really doesn't suit my use case.
Edit I've made a basic codepen to demonstrate how touchendoutside is only triggered once. https://codepen.io/Thomaswithaar/pen/EygRjM Do visit the pen on mobile, as it is about touches rather than mouse interactivity.
Holding two fingers on the red square and then moving them out and letting go will only trigger one touchendoutside event.
Looking at the PIXI source code, there is indeed a bug in the Interaction Manager. Here is the method that processes touch end events:
InteractionManager.prototype.processTouchEnd = function ( displayObject, hit )
{
if(hit)
{
this.dispatchEvent( displayObject, 'touchend', this.eventData );
if( displayObject._touchDown )
{
displayObject._touchDown = false;
this.dispatchEvent( displayObject, 'tap', this.eventData );
}
}
else
{
if( displayObject._touchDown )
{
displayObject._touchDown = false;
this.dispatchEvent( displayObject, 'touchendoutside', this.eventData );
}
}
};
You can see in the else statement that a touchendoutside event gets dispatched when displayObject._touchDown is true. But after you release your first finger, it sets the flag to false. That is why you only receive that event once.
I've opened an issue here:
https://github.com/pixijs/pixi.js/issues/2662
And provided a fix here:
https://github.com/karmacon/pixi.js/blob/master/src/interaction/InteractionManager.js
This solution removes the flag and uses a counter instead. I haven't tested it yet, so please let me know if it works.

Coded UI: Test cases having recording action are failed while executing through custom code

public void RecordedMethod_Sample(int x)
{
#region Variable Declarations
HtmlCell uISALESREVENUECell = this.UIDashboardWindowsInteWindow1.UIDashboardDocument.UITblWrapperOnlineStorTable.UISALESREVENUECell;
HtmlImage uIImagegifbase64R0lGODImage = this.UIDashboardWindowsInteWindow1.UIDashboardDocument.UIImagegifbase64R0lGODImage;
HtmlHyperlink uIPostPurchase4Hyperlink = this.UISalesRevenueandGrossWindow.UISalesRevenueandGrossDocument.UIPostPurchase4ReturnsCustom.UIPostPurchase4Hyperlink;
HtmlDiv uISalesRevenueByDataSoPane = this.UISalesRevenueandGrossWindow.UISalesRevenueandGrossDocument.UISalesRevenueByDataSoPane;
#endregion
// Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
Playback.PlaybackSettings.ContinueOnError = true;
// Mouse hover 'SALES REVENUE' cell at (82, 27)
Mouse.Hover(uISALESREVENUECell, new Point(82, 27));
// Reset flag to ensure that play back stops if there is an error.
Playback.PlaybackSettings.ContinueOnError = true;
// Click 'image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAA...' image
Mouse.Click(uIImagegifbase64R0lGODImage, new Point(139, 64));
// Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
Playback.PlaybackSettings.ContinueOnError = true;
// Mouse hover 'Post Purchase4' link at (144, 19)
Mouse.Hover(uIPostPurchase4Hyperlink, new Point(144, 19));
// Reset flag to ensure that play back stops if there is an error.
Playback.PlaybackSettings.ContinueOnError = true;
// Move 'Sales Revenue By Data Source' pane
Mouse.StartDragging(uISalesRevenueByDataSoPane, new Point(79, 15));
Mouse.StopDragging(uISalesRevenueByDataSoPane, 224, -4);
string title = uISalesRevenueByDataSoPane.InnerText.ToString();
if (title == "Sales Revenue By Data Source")
{
}
while Executing Mouse.Hover(uISALESREVENUECell, new Point(82, 27)); it is giving
following error
Specified method is not supported.
whenever i try to execute it as test case then everything is working as expected
while executing through custom code it is giving above mentioned error
can anybody please help me out...
thanks in advance for all your inputs
What does "custom code" mean? If it means custom controls then the error is likely because the custom control has not been written to support Coded UI. For a custom control to work with Coded UI it must support MSAA or UIA interfaces, or have support from the newer proxy mechanisms.
For more details try web searching for Coded UI, MSAA and UIA. Also have look at this blog http://blogs.msdn.com/b/visualstudioalm/archive/2012/05/24/coded-ui-test-new-extensibility-qfe.aspx
I had this exact problem.
Your best bet is to use the recorder as much as possible ,and then only move stuff away from UI map when you need dynamic execution and only for those bits.
Let the recorder do all the work for you, and you will get much better reliability during playback.

Resources