I am creating a simple power BI custom visual , which will have an image which when clicked will open the link in new browser window/tab. I have followind code in the constructor of visual.ts:-
constructor(options: VisualConstructorOptions) {
this.svgRoot = d3.select(options.element).append("svg");
this.rectElement = this.svgRoot.append('svg:a')
.attr('xlink:href', 'https://someurl')
.attr('target', '_blank')
.append('svg:image')
.attr('xlink:href' , 'http://imageurl')
}
I have tried following for target attribute:-
with no "target" attribute, the link opens in the same frame as the visual in this case
with "target" set to _parent and _top I get error which says:- "The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set."
with "target" attribute set to _blank, nothing happens here when I click on image.
I want _blank to work so that the link opens in new tab or browser window, can this be achieved.
Related
I'm using The Viewer's reporting feature in Winform, Which has the ability to export pdfs, but before clicking on the export to pop up the save window, a "exporting" window will appear, I want to hide this window but I can't solve it after trying some methods, who can help me?
Click on the screenshot of the question
I tried something but couldn't solve it:
foreach(Form item in Applictaion.OpenForms){
//Hide this window
if(item.Title == "正在导出")
item.Hide();
}
I also tried this:
if (this.reportViewer1.Controls.Find("exportDialog", true)[0] is Form form)
{
//"exportDialog" may be the Name property value I tried to find in the source code, but it was prompted that "index out of range"
form.Hide();
}
I am a newbie in Xlib world. In my project,I want to share my window to another via Remote desktop protocol, but they only saw content of window and didn't see anything if click on menu item of window. I used XGetImage to get data of specifies window. But If that window contain dialog ( see image here) I couldn't get data of dialog .
I use freeRDP source code, I modify in X11_shadow.c
function:
int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem){
...
image = XGetImage(subsystem->display, 58720435, 0, 0, surface->width,
surface->height, AllPlanes,ZPixmap); //with 58720435 is window id of chrome
... }
In my opinion, the most important here is how can I get data of dialog in Window. I have a solution :
1. get window id of that dialog ( I am not sure the dialog has owner Window ID)
2. Use XGetImage get data of that dialog.
But It's not working.
I works on Linux environment.
Are there any solutions for my problems?
Thank you very much
I am using this sidemenu module in my app.
In sidemenu i have option like home, setting etc.
When i click on setting, it redirect to setting page.
Now problem is when setting page is opened and i open side menu using swipe and again click on setting then it will again open setting screen on previous one.
Means it creating 2 setting screen.
If i repeat it again then it will creating again setting scree.
How do i prevent this?
My code for screen redirection is here
var win = Alloy.createController('Setting').getView();
window.closeOpenView();
$.navWindow.openWindow(win);
Store last opened page:
Add this outside the click function
var openWindow = '';
And this inside the click function
if (openWindow == 'Setting') return;
openWindow = 'Setting'
var win = Alloy.createController('Setting').getView();
window.closeOpenView();
$.navWindow.openWindow(win);
This assumes this is in a function, which I guess it is because it is a click handler. If not, wrap it in a function
I'm trying to just open http://espn.go.com/ and then click on the "NBA" tab using TestComplete.
Could someone tell me how to do this to get me started?
Thanks!
In the example below, you need a unique property name and value of the tab you want to click to be able to find it on the page. You can find this by clicking the tab using the Object Spy tool in test complete.
function nbaTest(){
var nbaTab;
//open browser at espn page
Browsers.Item("iexplore").Run("http://espn.go.com");
//search page for nba tab using a unique property name and corresponding property value of the nba tab
nbaTab = Sys.browser('iexplore').page("*").Find(propertyName,propertyValue,"1000","TRUE");
if (nbaTab.exists){
nbaTab.click();
}
else{
Log.Warning("NBA tab not found");
return;
}
}
I've tried using TestComplete' Recording feature - the script looks reliable. This is what was recorded:
var page;
Browsers.Item(btIExplorer).Navigate("http://espn.go.com/");
page = Aliases.browser.Page("http://espn.go.com/");
page.Panel(1).Panel("content").Panel("nav_wrapper").Panel("nav_wrapper_container").Panel("nav_main").Link("lpos_sitenavdefault_lid_sitenav_nba").Click();
Keyword test to open http://espn.go.com/ and then click on the "NBA" tab:
Steps:
Run TestComplete (I'm using version 10)
Launch the recording (By clicking "Record New Test" or "Append to Test")
Open IE and type the URL http://espn.go.com/ on address bar -> Click NBA tab -> Close the browser
Stop recording and see the KeywordTest you recorded in TestComplete IDE
My KeywordTest I recorded was as below:
Run Browser Parametrized (Internet Explorer, "", pX64) "http://espn.go.com/", ... Launches the specified browser and opens the specified URL in it.
pageEspnTheWorldwideLeaderInSpor Wait Waits until the browser loads the page and is ready to accept user input.
linkTennisM HoverMouse 0, 0 Moves the mouse pointer over the 'linkTennisM' control.
pageEspnTheWorldwideLeaderInSpor Wait Waits until the browser loads the page and is ready to accept user input.
panelModContainerModTabsModNoFoo ClickTab "NBA" Selects the 'NBA' tab of the 'panelModContainerModTabsModNoFoo' tab control.
linkNba HoverMouse 8, 6 Moves the mouse pointer over the 'linkNba' control.
panelHeader HoverMouse 658, 25 Moves the mouse pointer over the 'panelHeader' control.
ToolbarWindow32 ClickItemXY "&File", 16, 8, false Clicks at point (16, 8) of the '&File' item of the 'ToolbarWindow32' toolbar.
PopupMenu Click "Exit" Moves the mouse cursor to the menu item specified and then simulates a single click.
Not sure if this will help but you might be able to automate the step of opening your browser as well.
I use:
Call Sys.OleObject("WScript.Shell").Exec("cmd /c start /MAX iexplore ""http://espn.go.com""")
From there, you can automate the rest as usual (might need to wait for the page to load here as well).
I had created buttons on a dialog using resource editor(using Visual C++,X64) . On the button click event i have to show another window which is exactly of the same size and at same place (For further details i want to tell you that i have two buttons "next" and "previous" . on clicking them i have preview of "Image" and a "File" respectively). My dialog uses the handle of parent which comes from GetWindow function. See this please -
SomeClassOrFounctionNoMatterWhat::GetWindow(HWND *phwnd)
{
HRESULT hr = E_INVALIDARG;
if (phwnd)
{
*phwnd = m_hwndParent; //m_hwndParent is the parent handle now
hr = S_OK;
}
return hr;
}
So i mean the parent handle is m_hwndParent and using this handle i have created Dialog using this-
m_hwndPreview = CreateDialogParam(g_hInst
MAKEINTRESOURCE(IDD_MAINDIALOG),
m_hwndParent,
(DLGPROC)DialogProc,
(LPARAM)this);
and m_hwndPreview contains the button which i have created on the dialog IDD_MAINDIALOG.
and on button click event i am displaying the a file contents like this-
m_hwndPreview3 = CreateWindowExW(0,
MSFTEDIT_CLASS,
NULL, //This window is to display the html file.
WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_MULTILINE|ES_READONLY|WS_EX_TOPMOST,
m_rcParent.left, m_rcParent.top,
RECTWIDTH(m_rcParent),RECTHEIGHT(m_rcParent),
m_hwndPreview,
NULL,
NULL,
NULL); // similarly m_hwndPreview2 for image preview
See I am using m_hwndPreview as its parent which contains the buttons. I am doing so because i want to have buttons on my every window in order to display different contents by clicking on them.
So my problem is the buttons are created succesfully and are working properly but when i click any button it takes me on different window for the display of the file or Image. But when it takes me on different window the button disappears on the first sight and they appears only when i move mouse over them.
What should i do in order to have the button appearing on every window without moving mouse over them ?