Search Results

Search found 1599 results on 64 pages for 'pressed'.

Page 5/64 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to delay program for a certain number of milliseconds, or until a key is pressed?

    - by Jack
    I need to delay my program's execution for a specified number of milliseconds, but also want the user to be able to escape the wait when a key is pressed. If no key is pressed the program should wait for the specified number of milliseconds. I have been using Thread.Sleep to halt the program (which in the context of my program I think is ok as the UI is set to minimise during the execution of the main method). I have thought about doing something like this: while(GetAsyncKeyState(System.Windows.Forms.Keys.Escape) == 0 || waitTime > totalWait) { Thread.Sleep(100); waitTime += 100; } As Thread.Sleep will wait until at least the time specified before waking the thread up, there will obviously be a large unwanted extra delay as it is scaled up in the while loop. Is there some sort of method that will sleep for a specified amount of time but only while a condition holds true? Or is the above example above the "correct" way to do it but to use a more accurate Sleep method? If so what method can I use? Thanks in advance for your help.

    Read the article

  • JRockit Virtual Edition Debug Key

    - by changjae.lee
    There are a few keys that can help the debugging of the JRVE env in console. you can type in each keys in JRVE console to see what's happening under the hood. key '0' : System information key '5' : Enable shutdown key '7' : Start JRockit Management Server (port 7091) key '8' : Statistics Counters key '9' : Full Thread Dump key '0' : Status of Debug-key Below is the sample out from each keys. Debug-key '1' pressed ============ JRockitVE System Information ============ JRockitVE version : 11.1.1.3.0-67-131044 Kernel version : 6.1.0.0-97-131024 JVM version : R27.6.6-28_o-125824-1.6.0_17-20091214-2104-linux-ia32 Hypervisor version : Xen 3.4.0 Boot state : 0x007effff Uptime : 0 days 02:04:31 CPU : uniprocessor @2327 Mhz CPU usage : 0% ctx/s: 285 preempt/s: 0 migrations/s: 0 Physical pages : 82379/261121 (321/1020 MB) Network info : 10.179.97.64 (10.179.97.64/255.255.254.0) GateWay : 10.179.96.1 MAC address : 00:16:3e:7e:dc:78 Boot options : vfsCwd : /application/user_projects/domains/wlsve_domain mainArgs : java -javaagent:/jrockitve/services/sshd/sshd.jar -cp /jrockitve/jrockit/lib/tools.jar:/jrockitve/lib/common.jar:/application/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/application/wlserver_10.3/server/lib/weblogic.jar -Dweblogic.Name=WlsveAdmin -Dweblogic.Domain=wlsve_domain -Dweblogic.management.username=weblogic -Dweblogic.management.password=welcome1 -Dweblogic.management.GenerateDefaultConfig=true weblogic.Server consLog : /jrockitve/log/jrockitve.log mounts : ext2 / dev0; posixLocale : en_US posixTimezone : Asia/Seoul posixEncoding : ISO-8859-1 Local disk : Size: 1024M, Used: 728M, Free: 295M ======================================================== Debug-key '5' pressed Shutdown enabled. Debug-key '7' pressed [JRockit] Management server already started. Ignoring request. Debug-key '8' pressed Starting stat recording Debug-key '8' pressed ========= Statistics Counters for the last second ========= dev.eth0_rx.cnt : 22 packets dev.eth0_rx_bytes.cnt : 2704 bytes dev.net_interrupts.cnt : 22 interrupts evt.timer_ticks.cnt : 123 ticks hyper.priv_entries.cnt : 144 entries schedule.context_switches.cnt : 271 switches schedule.idle_cpu_time.cnt : 997318849 nanoseconds schedule.idle_cpu_time_0.cnt : 997318849 nanoseconds schedule.total_cpu_time.cnt : 1000031757 nanoseconds time.system_time.cnt : 1000 ns time.timer_updates.cnt : 123 updates time.wallclock_time.cnt : 1000 ns ======================================= Debug-key '9' pressed ===== FULL THREAD DUMP =============== Fri Jun 4 08:22:12 2010 BEA JRockit(R) R27.6.6-28_o-125824-1.6.0_17-20091214-2104-linux-ia32 "Main Thread" id=1 idx=0x4 tid=1 prio=5 alive, in native, waiting -- Waiting for notification on: weblogic/t3/srvr/T3Srvr@0x646ede8[fat lock] at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method) at java/lang/Object.wait(J)V(Native Method) at java/lang/Object.wait(Object.java:485) at weblogic/t3/srvr/T3Srvr.waitForDeath(T3Srvr.java:919) ^-- Lock released while waiting: weblogic/t3/srvr/T3Srvr@0x646ede8[fat lock] at weblogic/t3/srvr/T3Srvr.run(T3Srvr.java:479) at weblogic/Server.main(Server.java:67) at jrockit/vm/RNI.c2java(IIIII)V(Native Method) -- end of trace "(Signal Handler)" id=2 idx=0x8 tid=2 prio=5 alive, in native, daemon Open lock chains ================ Chain 1: "ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=23 idx=0x50 tid=20 waiting for java/lang/String@0x630c588 held by: "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=24 idx=0x54 tid=21 (active) ===== END OF THREAD DUMP =============== Debug-key '0' pressed Debug-keys enabled Happy Cloud Walking :)

    Read the article

  • Swing's KeyListener and multiple keys pressed at the same time.

    - by Negai
    Hi everyone, is there any conventional way in swing of tracking down the events, when two keyboard keys are pressed at the same time? I have a couple of ideas e.g. remembering the key and event generation time so that we could in a consecutive event handler invocation check the time difference between these two events and decide, whether it's a two-button event or not. Phew. But it looks like a kludge. Thanks in advance.

    Read the article

  • How can i check if key is pressed during click event with jquery?

    - by daniel smith
    Hi, I would like to catch a click event with jquery and be able to tell if a key was pressed at the same time so i can fork within the callback function based on the keypress. for example: $("button").click(function() { if([KEYPRESSED WHILE CLICKED]) { do something... } else { do something different... } }); Does anyone know if this is possible at all or how it can be done if it is possible?

    Read the article

  • Android - How to prevent the phone screen from turning on when volume or camera key is pressed?

    - by 2Real
    I have an activity that shows up when the phone screen goes to sleep/turns off ie turns black. For some reason, the phone turns on when the volume buttons or the camera buttons are pressed. By turns on, I mean the screen wakes up or comes back from the black screen state. I've tried using dispatchKeyEvent(KeyEvent event) and the buttons are disabled on the activity, but they still wake up the phone.

    Read the article

  • Slider with keypress control bugs when keys pressed to quickly.

    - by Jaybuz
    Hello, I've made a slider that uses the left and right arrow keys to move the slide but when pressed to quickly it will bug a little and I was wondering if it's possible to limit the amount of presses in say a second. You can see it here: {link} $('#slider-nav div').click(function() { $('#slider-nav div').removeClass('selected').addClass(''); $('#slider-nav div:eq('+($.jcarousel.intval($(this).text())-1)+')').addClass('selected'); }) // Allow left and right keys to control slider $(document.documentElement).keypress(function(e) { var code = (e.keyCode ? e.keyCode : e.which); var direction = null; // handle cursor keys if (code == 37) { // left key direction = 'prev'; } else if (code == 39) { // right key direction = 'next'; } if (direction != null) { $('#slider-nav div.selected')[direction]().click(); } });

    Read the article

  • KeyboardState.pressed is always true after .prompt or alert - Why?

    - by Yenza
    As the title says, I have tried THREEx and Stemkovskis standalone KeyboardState.js , and neither of them seems to update properly. This is my code: m_vKeyboard = new THREEx.KeyboardState(); // m_vKeyboard.update(); // if using stemkovskis if (m_vKeyboard.pressed("F")) { alert("And now it is always true!"); } you click the F key once, release it; alert window pops up, click OK, it pops up again for all eternity. How come?

    Read the article

  • VB.NET Inputbox - How to identify when the Cancel Button is pressed?

    - by The Sasquatch
    I have a simple windows application that pops up an input box for users to enter in a date to do searches. How do I identify if the user clicked on the Cancel button, or merely pressed OK without entering any data as both appear to return the same value? I have found some examples of handling this in VB 6 but none of them really function in the .NET world. Ideally I would like to know how to handle the empty OK and the Cancel seperately, but I would be totally ok with just a good way to handle the cancel.

    Read the article

  • How do I get the User Entered Value in AjaxControlToolkit ComboBox when the enter key is pressed?

    - by Jason
    The Problem: The user entered value is missing in the .Text attribute of the AjaxControlToolkit ComboBox when the enter key pressed. Also the “on change” events events are not called but I am not using postbacks anyway so I do not care. Example: private void BuildFileListDetails(NHibernateDataProvider _providerM) { int resultsPage = Convert.ToInt32(ddlNavPageNumber.Text); const int RESULTS_PAGE_SIZE = 100; // The cbFileName.Text equals "" Not what user entered string searchFileName= cbFileName.Text; var xrfFiles = _providerM.GetXrfFiles(searchFileName, resultsPage, RESULTS_PAGE_SIZE); gvXrfFileList.DataSource = xrfFiles; gvXrfFileList.DataBind(); } My Solution: I needed to access the AjaxToolkit "ComboBox" imbedded TextBox control's .Text to access the value entered by user. private void BuildFileListDetails(NHibernateDataProvider _providerM) { int resultsPage = Convert.ToInt32(ddlNavPageNumber.Text); const int RESULTS_PAGE_SIZE = 100; string searchFileName; //The Solution: Access the AjaxToolkit "ComboBox" imbedded TextBox control's .Text to access the value entered by user. TextBox textBox = cbFileName.FindControl("TextBox") as TextBox; if (textBox != null) { searchFileName = textBox.Text; //textBox.Text = "User Entered Value" } else { searchFileName = cbFileName.Text; } var xrfFiles = _providerM.GetXrfFiles(searchFileName, resultsPage, RESULTS_PAGE_SIZE); gvXrfFileList.DataSource = xrfFiles; gvXrfFileList.DataBind(); }

    Read the article

  • Javascript to fire event when a key pressed on the Ajax Toolkit Combo box.

    - by Paul Chapman
    I have the following drop down list which is using the Ajax Toolkit to provide a combo box <cc1:ComboBox ID="txtDrug" runat="server" style="font-size:8pt; width:267px;" Font-Size="8pt" DropDownStyle="DropDownList" AutoCompleteMode="SuggestAppend" AutoPostBack="True" ontextchanged="txtDrug_TextChanged" /> Now I need to load this up with approx 7,000 records which takes a considerable time, and effects the response times when the page is posted back and forth. The code which loads these records is as follows; dtDrugs = wsHelper.spGetAllDrugs(); txtDrug.DataValueField = "pkDrugsID"; txtDrug.DataTextField = "drugName"; txtDrug.DataSource = dtDrugs; txtDrug.DataBind(); However if I could get an event to fire when a letter is typed instead of having to load 7000 records it is reduced to less than 50 in most instances. I think this can be done in Javascript. So the question is how can I get an event to fire such that when the form starts there is nothing in the drop down, but as soon as a key is pressed it searches for those records starting with that letter. The .Net side of things I'm sure about - it is the Javascript I'm not. Thanks in advance

    Read the article

  • Strange. Asterisk key plays random Windows sound when pressed

    - by Charles
    This is a new one on me. When I press the "asterisk", or * button on my number pad (but not SHIFT+8), Windows makes either a "Exclamation" or "Windows ding" sound. I haven't noticed a pattern to which sound is made. Logitech K200 keyboard No special key mapping software or Logitech software running Realtek sound to stereo through optical cable. Visual Studio 2010, Chrome, Fiddler, WinRAR, Notepad++, and Dropbox running. No unusual behavior otherwise. A solution isn't terribly important but my curiosity is both piqued and stumped. This doesn't normally happen and nothing odd has taken place otherwise. Ideas?

    Read the article

  • Why is my keyboard acting like the Ctrl key is pressed when I hit an F key?

    - by Dan Tao
    So, I'm gradually getting the hang of the Kinesis Advantage Pro keyboard that my wife bought me for Christmas. I love it so far. But something very strange happened today. (Note: I actually have no idea if this problem has anything to do with the Kinesis keyboard per se. All I know is that I never encountered this problem until after replacing my old keyboard with the Kinesis.) It seems that if I press an F key (e.g., F2), the computer starts acting like I'm holding down the Ctrl key. For example if I click on a link in my web browser, it now opens in a new tab. Or if I hit A all the text in the document I'm editing gets selected. This behavior persists until I manually hit the Ctrl key again. Has anyone seen anything like this before? What could cause such behavior?

    Read the article

  • Multiple joysticks event handling

    - by hbaktir
    I want to make a game which is totally same idea with "Who pressed the button answers the question" I got 2 joysticks and both connected to a pc.My application will be Winforms and i will develop it on Visual studio 2012 . I 've used SlimDX,Sharpx so far i ' ve nothing for multiple joysticks.I can get the pressed button with timer . All i want to know is which joystick / gamepad pressed 1 button first.Then my problem will be solved Any idea how can i achive this or somebody did it before

    Read the article

  • Android addTextChangedListener onTextChanged not fired when Backspace is pressed?

    - by tsil
    I use addTextChangeListener to filter a list items. When the user enters a character on the editText, items are filtered based on user input. For example, if the user enters "stackoverflow", all items that contains "stackoverflow" are displayed. It works fine except that once the user press backspace to delete character(s), items are no longer filtered until he deletes all characters. For example, my items are: "stackoverflow 1", "stackoverflow 2", "stackoverflow 3", "stackoverflow 4". If user input is "stackoverflow", all items are displayed. If user input is "stackoverflow 1", only "stackoverflow 1" is displayed. Then user deletes the last 2 characters (1 and the space). User input is now "stackoverflow" but "stackoverflow 1" is still displayed and the other items are not displayed. This is my custom filter: private class ServiceFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults(); if (constraint == null || constraint.length() == 0) { // No filter implemented we return all the list results.values = origServiceList; results.count = origServiceList.size(); } else { List<ServiceModel> nServiceList = new ArrayList<ServiceModel>(); for (ServiceModel s : serviceList) { if (s.getName().toLowerCase().contains(constraint.toString().toLowerCase())) { nServiceList.add(s); } } results.values = nServiceList; results.count = nServiceList.size(); } return results; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { if (results.count == 0) { notifyDataSetInvalidated(); } else { serviceList = (List<ServiceModel>) results.values; notifyDataSetChanged(); } } } And how I handle text change event: inputSearch.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { if (cs.length() >= 1) { mAdapter.getFilter().filter(cs); } else { mAdapter = new ServiceAdapter(MyActivity.this, R.layout.ussd_list_item, serviceList); listView.setAdapter(mAdapter); } } });

    Read the article

  • AdMob ad in iPhone app makes App content disappear when "done" is pressed!

    - by nephilite
    Hello All, When I return from an adMob ad by hitting "done" the content of my app has disappeared ! All that remains is a background image I had attached directly to the main window. Oddly I can still hear the result of my touch events from my main screen (which is now gone). This may be related to the issue some people have had regarding a 20 pixel move involving the toolbar...I see something to that effect as the ad starts to overlay. I have admob in another app that is working fine, and I notice when the ad opens in that app the ad content fills the whole screen EXCEPT the top toolbar (it starts right under it). In the new app I'm working on right now this isn't the case. When the ad starts to open I see the tool bar vanish, then the add comes in and fills the entire screen (including the area where the tool bar was); then when I click done and the the ad goes away everything under it is gone as well. It may be worth noting that the App I had working was 2.x and the current app is 3.x (and thus using the admob 3.0 libraries). This is very odd and deal-breaking; I need help ASAP The relevant part of my view hierarchy is as follows: AppDelegate - ViewController - MainView (Ad is in here) There are also some other Views that are children of the ViewController and a UITabbar is also a subview of the ViewController (programmatically declared, not a UITabBar Controller). Any help you can offer would be extremely appreciate...I need to resolve this issue ASAP, release in two days! Thanks!!

    Read the article

  • Is it possible to hide the tabbar when a button is pressed to allow a full screen view of the conten

    - by Jonah
    I have a UITabBar in the detail view of my navigation based application. I am storing text and images in a tableview and would like the user to be able to tap on a cell to hide the navigation controller and the tabbar for full screen viewing of the content. I found this code for hiding the top bars, but it does not seem as easy to hide the tabbar. [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES]; [self.navigationController setNavigationBarHidden:YES animated:YES]; Does anyone know how to do this? This code does not work to hide the tabBar once the view is already loaded. yourTabViewController.hidesBottomBarWhenPushed = YES;

    Read the article

  • I'm capturing keys on my WinForm but I'm trying to see if the pressed key is a 'String' - getting an

    - by Sergio Tapia
    Here's my code: void gkh_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == neededLetter as Keys) { if (neededLetter == "n") { neededLetter = "o"; } else if (neededLetter == "o") { neededLetter = "t"; } else if (neededLetter == "t") { neededLetter = "e"; } else if (neededLetter == "e") { this.Show(); } } else { neededLetter = "n"; } } I'm getting an error on the first If block: The as operator must be used with a reference type or nullable type

    Read the article

  • Android - How to tell is someone has pressed a SPINNER but not changed the visible item in it.

    - by andy_spoo
    I have a spinner, which mostly works. If a user selects one of the items in it, the 'onItemSelected' routine catches it just fine. But if a user clicks the same spinner, but does not change from the already visible item that it's currently displaying, the 'onItemSelected' routine just ignores it, and the logs show:- WARN/InputManagerService(577): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@437948b0 I there anyway to capture someone doing this? The idea is that my spinner contains a list of names, and when a user selects one from the spinner, it gets added to a listview. I could just add another button to get the name from the spinner, but, screen-space is already lacking and I'd rather not add anymore content.

    Read the article

  • Android ListView clears when hard BACK key is pressed.

    - by Rpond
    In my android app I have a Tabhost with a ListView as one of the tabs. By clicking on an item in the ListView (an address) I start an Intent to Google Maps for directions and the choice dialog pops up for google maps, web browser etc. Problem is if I press the hard back button then the launch dialog goes away but also the ListView is cleared. Any idea why?

    Read the article

  • Java desktop app: How to maximize tray application when hotkey pressed?

    - by David
    I need to write a program that, when minimized, lives in the System Tray, and I'll use Java 6's SystemTray API to do that. How can I make that application comes to the foreground when the user presses some hotkey? For example, the app is running but minimized. When the user presses CTRL-SHIFT-Y or something (or, like Google Desktop's search, CTRL twice) and the application is maximized. EDIT: I know about how to bring a Java window to the foreground. I'm asking more specifically about how to make a running Java app listen for a hotkey.

    Read the article

  • How to print a page when a JButton is pressed in java swing using PrinterJob?

    - by Prayag Upd
    I tried the following code AWT but at runtime shows multiple print dialogs repeatedly.... package printerjob; import java.awt.BasicStroke; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.WindowAdapter; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; /** * * @author pragX */ public class FramePrinterJob extends Frame implements Printable{ public void start(){ add(button); } @Override public void paint(Graphics graphics){ PrinterJob printerJob=PrinterJob.getPrinterJob(); printerJob.setPrintable(this); if(printerJob.printDialog()){ try{ printerJob.print(); }catch(PrinterException printerException){ //printerException.printStackTrace(); System.out.println("Error Printing." + printerException); } } } public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { //throw new UnsupportedOperationException("Not supported yet."); if(pageIndex>=1){ return Printable.NO_SUCH_PAGE; } graphics.translate((int) pageFormat.getImageableX(), (int)pageFormat.getImageableY()); Graphics2D graphics2D=(Graphics2D)graphics; graphics2D.setStroke(new BasicStroke(4f)); graphics2D.drawLine(20, 20, 20, 120); graphics2D.drawLine(40, 20, 40, 120); graphics2D.drawLine(20, 70, 40, 70); graphics2D.drawLine(60, 70, 60, 120); graphics2D.drawLine(60, 40, 60, 45); return Printable.PAGE_EXISTS; } public static void main(String args[]){ Frame frame=new FramePrinterJob(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(){System.exit(0);}}); frame.setSize(300,400); frame.setVisible(true); } }

    Read the article

  • How can I change what happens when "enter" key is pressed on a DataGridView?

    - by SO give me back my rep
    when I am editing a cell and press enter the next row is automatically selected, I want to stay with the current row... I want to happen nothing except the EndEdit. I have this: private void dtgProductos_CellEndEdit(object sender, DataGridViewCellEventArgs e) { dtgProductos[e.ColumnIndex, e.RowIndex].Selected = true; //this line is not working var index = dtgProductos.SelectedRows[0].Cells.IndexOf(dtgProductos.SelectedRows[0].Cells[e.ColumnIndex]); switch (index) { case 2: { dtgProductos.SelectedRows[0].Cells[4].Selected = true; dtgProductos.BeginEdit(true); } break; case 4: { dtgProductos.SelectedRows[0].Cells[5].Selected = true; dtgProductos.BeginEdit(true); } break; case 5: { btnAddProduct.Focus(); } break; default: break; } } so when I edit a row that is not the last one I get this error: Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.

    Read the article

  • How to get drag working properly in silverlight when mouse is not pressed ?

    - by Mrt
    Hello, I have the following code xaml <Canvas x:Name="LayoutRoot" > <Rectangle Canvas.Left="40" Canvas.Top="40" Width="20" Height="20" Name="rec" Fill="Red" MouseLeftButtonDown="rec_MouseLeftButtonDown" MouseMove="rec_MouseMove" /> </Canvas> code behind public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } public Point LastDragPosition { get; set; } private bool isDragging; private void rec_MouseMove(object sender, MouseEventArgs e) { if(!isDragging) { return; } var position = e.GetPosition(rec as UIElement); var newPosition = new Point( Canvas.GetLeft(rec) + position.X - LastDragPosition.X, Canvas.GetTop(rec) + position.Y - LastDragPosition.Y); Canvas.SetLeft(rec, newPosition.X); Canvas.SetTop(rec, newPosition.Y); LastDragPosition = e.GetPosition(rec as UIElement); } private void rec_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { isDragging = true; LastDragPosition = e.GetPosition(sender as UIElement); rec.CaptureMouse(); } } This issue is the rectangle follows the mouse if the mouse left button is down, but I would like the rectangle to move even when the mouse left button isn't down. It works, but if you move the mouse very slowly. If you move the mouse to quickly the rectangle stops moving (is the mouse capture lost ?) Cheers,

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >