window

How do I move a window's position on the computer screen with javascript?

心已入冬 提交于 2019-12-21 17:53:08
问题 I remember seeing a google maps mashup / music video that created, resized, and moved windows on the screen. What javascript methods are used to do this? 回答1: I don't know how reliable this is, but to move the window relative to it's current position you can do this: window.moveBy(250, 250); //moves 250px to the left and 250px down http://www.w3schools.com/jsref/met_win_moveby.asp To move the window to a certain part of the screen: window.moveTo(0, 0); //moves to the top left corner of the

javascript 使用btoa和atob来进行Base64转码和解码

泪湿孤枕 提交于 2019-12-21 17:07:05
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> javascript原生的api本来就支持,Base64,但是由于之前的javascript局限性,导致Base64基本中看不中用。当前html5标准正式化之际,Base64将有较大的转型空间,对于Html5 Api中出现的如FileReader Api, 拖拽上传,甚至是Canvas,Video截图都可以实现。 好了,前言说了一大堆,开发者需要重视: 一.我们来看看,在javascript中如何使用Base64转码 var str = 'javascript'; window.btoa(str) //转码结果 "amF2YXNjcmlwdA==" window.atob("amF2YXNjcmlwdA==") //解码结果 "javascript" 二.对于转码来说,Base64转码的对象只能是字符串,因此来说,对于其他数据还有这一定的局限性,在此特别需要注意的是对Unicode转码。 var str = "China,中国" window.btoa(str) Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the

Mac OS X - How to monitor a window change event?

Deadly 提交于 2019-12-21 17:06:03
问题 I'm developing a Cocoa application that shows a list of opened windows and highlights the current focused one. My problem is that I can't find a system notification to inform my app that the main (aka "focused" or "foreground") window has changed. I tried with: [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(wsNotificationHook:) name:NSWorkspaceDidActivateApplicationNotification object:nil]; but it monitors APPLICATION change: it isn't get fired when a

How to make main window wait until a newly opened window closes in C# WPF?

喜欢而已 提交于 2019-12-21 12:18:54
问题 I am new to WPF as well as C#, please bear with me. I have a main window which opens up a new window. Now this new window is a prompt whether or not to overwrite a file, and the main window accesses a public variable in the new window to check for the prompt's result. But I can't get the main window processing to wait until the new window closes. Window1 Win = new Window1(); Win.Show(); if (Win.pr_res == 1) { abc.Text = "File to be overwritten"; File.Delete(_destination); Start(); } else {

When does the *Window focus* change in Android?

人走茶凉 提交于 2019-12-21 09:15:53
问题 In my project, I need to catch the Window focus change. I have logged out the results for all the stages of an activity. When the screen is on, the result is as follows: 02-17 13:50:03.898: DEBUG/InquiryInterface(3829): onCreate screen state : false 02-17 13:50:03.898: DEBUG/InquiryInterface(3829): onStart screen state : false 02-17 13:50:03.898: DEBUG/InquiryInterface(3829): onResume screen state : false 02-17 13:50:08.998: DEBUG/InquiryInterface(3829): onPause screen state : true 02-17 13

Drag a WPF Form around the desktop

耗尽温柔 提交于 2019-12-21 07:20:15
问题 i am trying to make a c# WPF form where i can drag it around the screen by clicking on it and moving with the mouse. the forms characteristics include being completely transparent and containing only one image. This being said the window style is none and it is not displayed in the taskbar. So essentially all you can see when the app is running is a little image - and ideally i want to be able to drag it around the desktop if i click and hold the left mouse button and move it about. Does

Avoiding the window (WPF) to freeze while using TPL

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 06:19:13
问题 I am building a WPF which has a button that execute a sql query in sql server (the query could take a long time to run). I want to use TPL for doing that. This code: var result = Task.Factory.StartNew(() => { command.ExecuteNonQuery(); }); gives this exception: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed. I guess this is due to the fact that the query runs on a different thread and is not aware of the open connection. I have 2 questions:

Avoiding the window (WPF) to freeze while using TPL

泄露秘密 提交于 2019-12-21 06:18:27
问题 I am building a WPF which has a button that execute a sql query in sql server (the query could take a long time to run). I want to use TPL for doing that. This code: var result = Task.Factory.StartNew(() => { command.ExecuteNonQuery(); }); gives this exception: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed. I guess this is due to the fact that the query runs on a different thread and is not aware of the open connection. I have 2 questions:

Java single instance software with socket. issue in closing socket under windows

自作多情 提交于 2019-12-21 05:36:16
问题 I need to force my Java application to run with a single instance. I found on this link this very nice piece of code that solve the problem using socket instead of using the file system. here the as i adjusted: package cern.ieplc.controller; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import org.apache.log4j.Logger; import java.io.BufferedReader; import java.io.IOException; import

Firefox Open a new tab instead of a pop window? [closed]

会有一股神秘感。 提交于 2019-12-21 04:27:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . I found that in recent version of Firefox, there was add a setting called "Open new windows in a new tab instead". When I keep it on, all the pop windows(Using javascript "window.open" function opened) opened in a new tab, which I realy need opened in a pop window(With settings like "menubar=no" and etc.). Some