I have written a windows console based text-editor with C & I'm gonna add copy/paste feature to it.
Editor is made up of a doubly-linked list that each structure just contains one letter. editor gets letters, arrow keys, backspace, ... with getch function (which is found in conio.h) & uses their ascii code to recognize them.
when a selection is made and CRTL+C is pressed, the selection is copied to memory but I don't know where to get that copied text.
Hope I cleared the problem,
Thanks.
Related
In Sublime Text there's a way to highlight all similar strings by setting a cursor to every one of them, and then you can just type something, and this text will be printed in every highlight area. In rus version it's called "multicursor".
Is there something like that in CodeRush?
I know about "Replace all" function in Visual Studio. But this approach is not as convenient as the approach described earlier.
Something like that you can see in Rename feature of CodeRush.
Documentation:
When the Rename is activated, it turns all references to the selected
variable into the linked identifiers.
Linked identifiers are related sections that are kept synchronized. If
you change the text within one of them, all others get updated
accordingly.
There are also the Multi-Select feature which allows you to select separate text blocks by pressing CTRL + ALT + ENTER, but this feature does not allows you to edit every highlight area:
Problem:
I wish to underline the first letter of certain static text controls (such as Login and Password). The letters become underlined when the ALT key is pressed.
What I have tried:
In C#, I was able to acheive this by using an ampersand. Such as "&Log in" or "&Password". I am trying to find a similar method in C++. The below picture shows an example in C#:
I am using MFC/C++ in Visual Studio 2010.
Edit:
Added information about the ALT key. Here is an example of what I am trying in Visual Studio 2010's properties box. I am adding an ampersand to the front of the "Caption"'s text.
When I run my program in the debugger, the first letter is not underlined (until ALT is pressed):
There's a fundamental difference between a menu and a static control.
To do this in a menu, you do it just like in C#. Here's a screen shot of editing a menu in a C++ project:
...and here's the result:
For a static control, you have to clear the SS_NOPREFIX style for the control to get the same behavior. However, it's been my observation that under some circumstances the underline doesn't show (but I haven't ever pinned down the precise circumstances under which the underline didn't show--I think when it happened, I fixed it by changing the font, but I don't remember for sure).
After help from the SO community, it seems that using the ampersand (&) symbol before the desired underlined letter is the correct way. There was a setting on my personal machine that would keep the underlined letters hidden until the ALT key was pressed.
According to the MSDN:
A user often has to press ALT in order to see access key designations. To ensure that you address them throughout the development process, set your computer to persistently display access keys.
In Windows 8: Open Control Panel -> Ease of Access Center -> Make the Keyboard easier to use.
At the bottom of the screen, check "Underline keyboard shortcuts and access keys".
I'm writing a simple text editor using Python 2.7, pyqt library. I basically want to display the meaning of a word when the user selects the word in the text editor.
So far I can detect the word under the cursor, look it up in my dictionary and return the meaning (using a print statement) so I know I can get the guts to work.
My trouble is displaying the meaning of the word in a tooltip that doesn't dissapear in less than 2 miliseconds. So far I have been using this:
QtGui.QToolTip.showText(QtGui.QCursor.pos(), tool_tip_text)
Ideally want to show the meaning just over where the selection was made, so far this displays the tooltip so quickly that I can't even read the meaning of the word under the cursor. It just pops up and dissapears almost immediately. Can anyone share how to make the tooltip remain visible for at least 5 seconds, or until the user de-selects the word.
I am not using the QHELPEVENT (not even quite sure how the helpevent is triggered) I am just calling my lookup_word_in_dictionary() function when a word has been selected.
Any samples are much appreciated.
Thanks, I found a solution, creating my own popup class, subclassed from QWidget
and used a simple timer to hide the tooltip
QTimer.singleShot(5000, self.hide_tooltip) #check to see if the tooltip shold be hidden after 5 secs
you can replace QToolTip by QSplashScreen,if you are Chinese ,please look at this post .
BTW , can you share the method that you detect the word under the cursor with me ?
I'm building a VCL c++ builder application. I would like to see if anyone knows of a component that can load data in the lookup upon drop down only after a user has typed a few letters to limit the rows queried? Preferably after pressing Tab, or Enter.
What I would like best is to get a behaviour similar to what Linux command line has, but that might be wishful thinking. The way it would work is to drop down the combo list after user presses tab only if there is multiple options available, and to fill in additional text till the point where characters are not the same anymore, then if user presses tab again, drop down list.
The next best would be if the drop down would only allow drop down if user has typed a few letters, then pressing a specific button opens the dataset with the parameter of the typed text so far, then drops down the combo.
Does a component like this exist?
You can check out TMS Software. I'm not sure if it has something exactly for you, but their components are quite flexible. And you can send a feature request to them - to consider for next update. If you are lucky they might add it to next release.
My app uses standard single-line Edit Box controls. Is there any way to accept a multi-line "paste", discarding carriage return / linefeeds?
Notes
I don't want to use multi-line controls
My app is VS2010 C++ with WTL (not MFC or ATL)
The reason I want this is because actual input is normally quite short, but could in rare circumstances be hundreds or even thousands of characters. In which case users might well want to build the string using NotePad or whatever, then just cut & paste it in.
This is not possible as the user is pasting himself/herself. An alternative is to use a multi-line Edit Box and displaying all the data into one line by managing the pasted data into OnChange function for your control (basically disregading new lines).