Search Results

Search found 143 results on 6 pages for 'caret'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Maintaing JTextArea scroll position

    - by Sami
    I have a JScrollPane with a JTextArea set as its view port. I update the (multi line) text shown on the JTextArea continously about once a second. Each time the text updates, JScrollPane goes all the way to the bottom of the text. Instead, I'd like to figure out the line number that is currently shown as the first line in the original text, and have that line be the first line shown when the text has been updated (or if the new text doesn't have that many lines, then scroll all the way to the bottom). My first attempt of doing this was to get the current caret position, figure the line based on that, and then set the text area to show that line: int currentPos = textArea.getCaretPosition(); int currentLine = 0; try { for(int i = 0; i < textArea.getLineCount(); i++) { if((currentPos >= textArea.getLineStartOffset(i)) && (currentPos < gameStateTextArea.getLineEndOffset(i))) { currentLine = i; break; } } } catch(Exception e) { } textArea.setText(text); int newLine = Math.min(currentLine, textArea.getLineCount()); int newOffset = 0; try { newOffset = textArea.getLineStartOffset(newLine); } catch(Exception e) { } textArea.setCaretPosition(newOffset); This was almost acceptable for my needs, but requires the user to click inside the text area to change the caret position, so that the scrolling will maintain state (which isn't nice). How would I do this using the (vertical) scroll position instead ?

    Read the article

  • Drag-n-Drop on contentEditable elements

    - by Raybiez
    There are numerous WYSIWYG editors available on the internet, but I'm yet to find one that implements some form of drag-n-drop implementation. It is easy to create one's own editor, but I want to the user to be able to drag elements (ie. tokens) from outside the editable area and have them drop it at a location of their choice inside the editable area. It is easy to inject html at a specific location of an editable element, but how do one determine where the caret should be when the user is dragging a DIV over some element in the editable area. To better illustrate what I'm trying to explain, see the following scenario. The editable area (either an IFRAME in edit mode or a DIV with its contentEditable attribute set to true) already contains the following text: "Dear , please take note of ...." The user now drags an element representing some token from a list of elements, over the editable area, moving the cursor over the text until the caret appear just before the comma (,) in the text as shown above. When the user releases the mouse button at that location, HTML will be injected which could result in something like this: "Dear {UserFirstName}, please take note of ...". I do not know if anyone has ever done anything similar to this, or at least know of how one would go about doing this using JavaScript. Any help will be greatly appreciated.

    Read the article

  • JTextField vs JComboBox behaviour in JTable

    - by Ash
    Okay, this is a hard one to explain but I'll try my best. I have a JTextField and a JComboBox in a JTable, whose getCellEditor method has been overriden as follows: public TableCellEditor getCellEditor( int row, int column ) { if ( column == 3 ) { // m_table is the JTable if ( m_table.getSelectedRowCount() == 1 ) { JComboBox choices = new JComboBox(); choices.setEditable( true ); choices.addItem( new String( "item 1" ) ); return new DefaultCellEditor( choices ); } return super.getCellEditor( row, column ); } Here are the behavioral differences (NOTE that from this point on, when I say JTextField or JComboBox, I mean the CELL in the JTable containing either component): When I click once on a JTextField, the cell is highlighted. Double clicking brings up the caret and I can input text. Whereas, with a JComboBox, single clicking brings up the caret to input text, as well as the combo drop down button. When I tab or use the arrow keys to navigate to a JTextField and then start typing, the characters I type automatically get entered into the cell. Whereas, when I navigate to a JComboBox the same way and then start typing, nothing happens apart from the combo drop down button appearing. None of the characters I type get entered unless I hit F2 first. So here's my question: What do I need to do have JComboBoxes behave exactly like JTextFields in the two instances described above? Please do not ask why I'm doing what I'm doing or suggest alternatives (it's the way it is and I need to do it this way) and yes, I've read the API for all components in question....the problem is, it's a swing API. Thanks in advance, Ash

    Read the article

  • SWT Drag and Drop support for Text widget

    - by bryantsai
    I've written an application recently using SWT. In one of its dialog box, I have a few widgets, one of which is Text, which is designed to support DND with other widgets. I've first added DND support for the 2 Tree widgets on the same dialog box (both drag source and drop target). Before I added DND support for that Text widget, I noticed that on Linux platform (gtk), SWT Text widget automatically get drag and drop support. That is, I can already drag from the other Tree widgets and drop on this Text (at any position to inserted there), as well as selecting and dragging any text from this Text to other Tree or Text widget. However, this is only working on Linux platform but not on Windows. The same program, if running on Windows, will not have any DND support for that Text widget (Tree widgets of course have DND support since I specifically write for them). So here's what I want to achieve on Windows as well: drop text at any position in Text widget. before dropping and while hovering, able to see the caret position clearly where the intended position to drop. caret position should move along with the mouse cursor. support multi-line in Text widget SOLUTION: DropTarget target = new DropTarget(sytledText, DND.DROP_MOVE | DND.DROP_COPY); target.setTransfer(new Transfer[] { TextTransfer.getInstance() }); target.addDropListener(new StyleTextDropTargetEffect(sytledText)); Use StyledText instead of Text widget Use StyledTextDropTargetEffect (or extend it) and add it as dr op listener

    Read the article

  • SDL (And Others) Virtual Key Input

    - by David C
    Today I set up the input in my application for all the different keys. This works fine except for virtual keys, for example, caret or ampersand. Keys that normally need shift to be got at. Using SDL these virtual keys don't work. As in they do not register an event. if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { case SDLK_CARET: Keys[KeyCodes::Caret] = KeyState::Down; break; case SDLK_UP: Keys[KeyCodes::Up] = KeyState::Down; break; default: break; } I am absolutely sure my system works with physical keys like Up. The program queries a keystate like so: if (Keys[KeyCode] == KeyState::Down) { lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } KeyCode is passed in as an argument. So why are virtual keys, or keys that need shift to get at not working using SDL's KeyDown event type? Is more code needed to get to them? Or am I being stupid?

    Read the article

  • Assess BIOS on HP Pavilion xt966

    - by NitroxDM
    I'm attempting to change the boot device priority on a older HP. When it starts up it flashes a HP splash screen then just goes black with a blinking caret. I tried the suggestion of leaving it off for 5 sec then hitting F1. No dice. I'm using a USB keyboard. I might grab a PS2 and give it a go. Any other ideas?

    Read the article

  • How to turn off the cursor in OpenOffice

    - by hcs42
    When OpenOffice opens a file in read-only mode, it does not show a cursor, and the arrow keys (up and down) will move the page instead of the cursor. (By "cursor", I mean the blinking thing also called "caret" and not the mouse cursor.) Is there any way to turn off the cursor when the document is not read-only?

    Read the article

  • Index independent character comparison within text blocks

    - by Michael IV
    I have the following task: developing a program where there is a block of sample text which should be typed by user. Any typos the user does during the test are registered. Basically, I can compare each typed char with the sample char based on caret index position of the input, but there is one significant flaw in such a "naive" approach. If the user typed mistakenly more letters than a whole string has, or inserted more white spaces between the string than should be, then the rest of the comparisons will be wrong because of the index offsets added by the additional wrong insertions. I have thought of designing some kind of parser where each string (or even a char ) is tokenized and the comparisons are made "char-wise" and not "index-wise," but that seems to me like an overkill for such a task. I would like to get a reference to possibly existing algorithms which can be helpful in solving this kind of problem.

    Read the article

  • GNOME 3.4 released, with smooth & fast magnification

    - by Peter Korn
    The GNOME community released GNOME 3.4 today. This release contains several new accessibility features, along with a new set of custom high-contrast icons which improve the user experience for users needing improved contrast. This release also makes available the AEGIS-funded GNOME Shell Magnifier. This magnifier leverages the powerful graphics functionality built into all modern video cards for smooth and fast magnification in GNOME. You can watch a video of that magnifier (with the previous version of the preference dialog), which shows all of the features now available in GNOME 3.4. This includes full/partial screen magnification, a magnifier lens, full or partial mouse cross hairs with translucency, and several mouse tracking modes. Future improvements planned for GNOME 3.6 include focus & caret tracking, and a variety of color/contrast controls.

    Read the article

  • Why should I learn vi/vim/emacs? [on hold]

    - by Tom Busby
    I hear all the flame wars about vi/vim and emacs and which is better etc but honestly, I just use sublime. When I have to edit from the CLI I use nano (it's simpler to use). I'm wondering if I'm missing something. Should I put the time/effort into learning one of those text-editors thoroughly, and if so... why? What is it about these two editors that evokes so much adoration and devotion? Why would I want to use any of them over my nice, multi-caret, GUI text editor?

    Read the article

  • Trouble installing 12.04 from cd, blank screen with cursor

    - by Master Morality
    I should preface this with saying that this is not my first rodeo. I started playing with Linux in 1999 (Red Hat) and I'm currently typing this on a ThinkPad running 12.04... When I put in the live cd, I boots, and I can get to the option menu to decide whether to install/run etc, but at any point beyond that I get only a single caret. I can type stuff in, but it goes no where. I've tried the usual stuff like running with nomodeset (thinking it was the intel HD400 graphics, but it is integrated graphics...) here is the setup: ASUS p8z77 pro (with the Atheros AR9485 wifi supposedly, but I'm not that far yet) i7 3370k 8gig X 2 G.Skill Crucial M4 (256 gig) LG Super-multi DVD re-writer no video card UPDATE: I though may be it was a bad image on the CD, so I downloaded another iso, and used a USB disk. now it boots to a blank screen. I can see the "press any key to get options" screen, but after that, it just goes to a blank screen.

    Read the article

  • Philosophy of scroll bars [closed]

    - by Parkhid
    Please suppose I want to design my own text editor . simply like notepad. Without using any richtextbox or other controls LIKE EDIT in C++. Main Handle is just a window in C++ or usercontrol in C#. The Question is here for scrolling option , how can I perform scrolling when user is typing. I mean vertical scrolling here . What is Philosophy of works of scroll bars in C++ windows or C# user controls ? Should I Clear the (Usercontrol or Window) When User reaches to end of (Usercontrol or Window) and then Put caret on start of (Usercontrol or Window) ? What about scrolling with thumb or hand scrolling ? How can I find the Text Position which scroll to ?

    Read the article

  • wxPython - Running built in event prior to custom bound event

    - by jhaukur
    I'm trying to figure out how I can specify that the mouse_down event in wxPython (StyledTextCtrl) is first handled by the built in event listener, which changes the caret position, and then handled by my own custom event handler. To bind the custom event handler I use wx.EVT_LEFT_DOWN(self.styCtrl, self.OnMouseClick) def OnMouseClick(self, evt): evt.Skip() foo() I want the built in event handler to fire and complete prior to foo().

    Read the article

  • Disable text selection in QT/WebKit GUI

    - by Adal
    I'm checking if it would be possible to implement a GUI using HTML through PyQT and WebKit. One of the problem is that using the mouse you can select the text making up the interface. Can this behaviour be disabled? Also, the mouse pointer changes to an insertion caret while over the selectable text. I would like to disable this, without disabling the hand mouse pointer which appears when over a clickable link.

    Read the article

  • How to automatically insert code for an XCode video demo

    - by Mike Weller
    I've been watching some of the WWDC 2009 videos which include some video demos in XCode. The presenters are using some sort of macro or script bound to a keyboard shortcut to automatically insert some pre-prepared code at the current caret location. Each time they press the key, the next prepared snippet is inserted. Does anybody know how this is done?

    Read the article

  • Why do I get extra, unexpected results with my ack regex?

    - by Gauthier
    I'm finally learning regexps and training with ack. I believe this uses Perl regexp. I want to match all lines where the first non-blank characters are if (<word> !, with any number of spaces in between the elements. This is what I came up with: ^[ \t]*if *\(\w+ *! It only nearly worked. ^[ \t]* is wrong, since it matches one or none [space or tab]. What I want is to match anything that may contain only space or tab (or nothing). For example these should not match: // if (asdf != 0) else if (asdf != 1) How can I modify my regexp for that? EDIT adding command line ack -i --group -a '^\s*if *\(\w+ *!' c:/work/proj/proj Note the single quotes, I'm not so sure about them anymore. My search base is a larger code base. It does include matching expressions (quite some), but even for example: 274: }else if (y != 0) , which I get as a result of the above command. EDIT adding the result of mobrule's test Mobrule, thanks for providing me a text to test on. I'll copy here what I get on my prompt: C:\Temp\regex>more ack.test # ack.test if (asdf != 0) # no spaces - ok if (asdf != 0) # single space - ok if (asdf != 0) # single tab - ok if (asdf != 0) # multiple space - ok if (asdf != 0) # multiple tab - ok if (asdf != 0) # spaces + tab ok if (asdf != 0) # tab + space ok if (asdf != 0) # space + tab + space ok // if (asdf != 0) # not ok } else if (asdf != 0) # not ok C:\Temp\regex>ack '^[ \t]*if *\(\w+ *!' ack.test C:\Temp\regex>"C:\Program\git\bin\perl.exe" C:\bat\ack.pl '[ \t]*if *\(\w+ *!' a ck.test if (asdf != 0) # no spaces - ok if (asdf != 0) # single space - ok if (asdf != 0) # single tab - ok if (asdf != 0) # multiple space - ok if (asdf != 0) # multiple tab - ok if (asdf != 0) # spaces + tab ok if (asdf != 0) # tab + space ok if (asdf != 0) # space + tab + space ok // if (asdf != 0) # not ok } else if (asdf != 0) # not ok The problem is in my call to my ack.bat! ack.bat contains: "C:\Program\git\bin\perl.exe" C:\bat\ack.pl %* Although I call with a caret, it gets away at the call of the bat file! Escaping the caret with ^^ does not work. Quoting the regex with " " instead of ' ' works. My problem was a DOS/win problem, sorry for bothering you all for that.

    Read the article

  • Where can I find a library that parses source code and is able to extract the scope of where your cursor is currently in the code?

    - by Anthony
    In SublimeText(2), when you press [ctrl + shift + p] (mac osx) you are shown a scope of where your caret/cursor is in the source code at the given moment e.g.: entity.name.tag.inline.any.html meta.tag.inline.any.html text.html.basic I am curious about what library or script is used to parse the document/file and create that scope string. A sidenote: Typing view.syntax_name(view.sel()[0].b) into Sublime's console will output the scope as well.

    Read the article

  • Get the currently focused textbox in C#

    - by chown
    I have two textboxes, and a button. When I press the button, I want to know where my current caret is (either of the two boxes). I need this to know where to insert a certain text. I tried textbox1.Focused; textbox1.enabled but neither worked. How should I implement this? Thanks

    Read the article

  • Insert text at cursor in a content editable div

    - by nijikunai
    I have a contenteditable div where I need to insert text at the caret position, This can be done in IE by document.selection.createRange().text = "banana" Is there a similar way of implementing this in Firefox/Chrome? (I know a solution exists here , but it looks sorta clumsy) Thank you!

    Read the article

  • Jump to the start of next statement

    - by Borek
    Say that I'm writing a test and my caret is here (indicated by "|"): [ExpectedException(typeof(InvalidOperationException|))] In Visual Studio 2010, I'd like to press some shortcut that would take me to the next line so that I could start typing "public void Etc()". Right now, I need to press Right arrow Right arrow Right arrow Enter Which is too many key presses IMO. Is there a VS2010 / ReSharper shortcut to aid this operation?

    Read the article

  • How do I export HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe with regedit from cmd.exe?

    - by René Nyffenegger
    I am trying to export the registry key HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe but am unable to do so, probably because of the percent signs. I tried to escape the %-sign with a caret or another %-sign, but this didn't help me: regedit /e c:\temp\cmd.reg "HKEY_CURRENT_USER\Console\%%SystemRoot%%_system32_cmd.exe" and regedit /e c:\temp\cmd.reg "HKEY_CURRENT_USER\Console\^%SystemRoot^%_system32_cmd.exe" So, is there a way to do what I want. Edit as per ??????? ???????????'s comment: the key is the exact string, with the percent signs. So I don't want %SystemRoot% expanded, but passed to regedit as is.

    Read the article

  • Problem with Ctrl key on a hp 2510p

    - by Ernelli
    I have a tricky problem with my corporate Compaq hp 2510p, the ctrl key is not working properly at all times. I belive that it is hooked in some filter chain that processes certain ctrl+[key] combinations which is very annoying. I would like some pointers on how to proceed when analysing what application/setup can can cause this kind of keyboard filtering to happen. Anyway some more background info: Ctrl works together with X, C, V. Both in editors and terminals (Ctrl-C, Z etc) but Ctrl-Shift-Esc and Ctrl-Alt-Del does not work. Very annoying so my only option for logging in us using HP's security app. Shift-Arrow works for selecting text, but not Ctrl-shift arrow to select word by word, but Ctrl-Arrow works when moving the caret word by word. Now the strange thing is that everything works ok with an external USB keyboard so it might be the driver, but still, google yields 0 when searching for the problem description. I have vm-ware player installed (but not running it), HP Protect Tools installed, if any of these could affect the keyboard driver.

    Read the article

  • User and Key Press Issues with Putty

    - by DizzyDoo
    Ubuntu Server newbie here, got some annoying issues with remote accessing my box with Putty. When I create a user and then login as that user, the terminal always starts with just '#' and not 'user@hostname:~#' which isn't useful where I want to see where I've changed directory too, like I can normally. Also, when logged in as a user, I can't press the cursor keys to move the caret (blinking thing) around, or press up to see previously executed commands. Instead it gives me this representation of the button pressed: ^[[D ^[[A ^[[B ^[[C. Pressing Delete, too, gives me ^[[3~. This is all strange to me, because when logged in as root, it all works fine. I'm hoping this is just something I've accidentally changed in Putty, or added the user wrongly, or perhaps just got caps lock on. Thanks.

    Read the article

  • Seeing double-cursor in 'recursive RDP'

    - by John
    I'm using a Virtual PC VM on my PC to connect to a remote PC using RDP over a VPN. It works just fine except that in the RDP session, I often see a double mouse cursor... I get a standard mouse-arrow and the context-specific cursor such as a caret or hourglass. It's not a big problem but rather annoying and I wondered if there's any way to fix it, or at least understand where it comes from? Is it because I'm effectively running one RDP session from inside another? My host PC runs W7, my local VM runs XP, and the remote PC access using RDP is W7. Thankyou for any help.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >