Click here to Skip to main content
15,560,045 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
PinnedHOW TO ANSWER A QUESTION Pin
Chris Maunder16-Jul-09 4:09
cofounderChris Maunder16-Jul-09 4:09 
PinnedHow to get an answer to your question Pin
Chris Maunder16-Jul-09 4:05
cofounderChris Maunder16-Jul-09 4:05 
QuestionHow to use bluetooth to pass simple ASCII serial data ? Pin
Member 1496877128-Dec-22 17:58
Member 1496877128-Dec-22 17:58 
AnswerRe: How to use bluetooth to pass simple ASCII serial data ? Pin
Richard MacCutchan28-Dec-22 22:41
mveRichard MacCutchan28-Dec-22 22:41 
GeneralRe: How to use bluetooth to pass simple ASCII serial data ? Pin
Member 1496877129-Dec-22 4:39
Member 1496877129-Dec-22 4:39 
GeneralRe: How to use bluetooth to pass simple ASCII serial data ? Pin
Member 1496877129-Dec-22 9:49
Member 1496877129-Dec-22 9:49 
AnswerRe: How to use bluetooth to pass simple ASCII serial data ? Pin
Eddy Vluggen29-Dec-22 9:42
professionalEddy Vluggen29-Dec-22 9:42 
QuestionBluetooth device / service ? Pin
Member 1496877120-Dec-22 4:23
Member 1496877120-Dec-22 4:23 
QuestionOverall System Speed Performance Difference DDR3 vs DDR4 Pin
BernardIE531713-Dec-22 13:15
BernardIE531713-Dec-22 13:15 
AnswerRe: Overall System Speed Performance Difference DDR3 vs DDR4 Pin
Richard MacCutchan14-Dec-22 0:16
mveRichard MacCutchan14-Dec-22 0:16 
AnswerRe: Overall System Speed Performance Difference DDR3 vs DDR4 Pin
tugrulGtx17-Dec-22 9:18
mvatugrulGtx17-Dec-22 9:18 
QuestionTrying to use GPU detection, Google has failed me. Pin
Jordan Reardon7-Dec-22 13:43
Jordan Reardon7-Dec-22 13:43 
QuestionNetwork questions Pin
Joan M24-Nov-22 1:53
professionalJoan M24-Nov-22 1:53 
Questionhow to identify the " selected text highlights" event ? Pin
Member 1496877121-Nov-22 8:20
Member 1496877121-Nov-22 8:20 
AnswerRe: how to identify the " selected text highlights" event ? Pin
trønderen21-Nov-22 9:16
trønderen21-Nov-22 9:16 
GeneralRe: how to identify the " selected text highlights" event ? Pin
Member 1496877121-Nov-22 14:28
Member 1496877121-Nov-22 14:28 
GeneralRe: how to identify the " selected text highlights" event ? Pin
trønderen22-Nov-22 5:25
trønderen22-Nov-22 5:25 
Member 14968771 wrote:
Your analogy is plausible, however, it does not explain how clicking on the text highlights it – if it is "gone" / does not exist per your explanation.
It does not exist in your application (well, your application may still have the original, from which a copy was sent to xterm, but that is a different object). But xterm saves in its own buffer the output it receives from the application. It uses the contents of the buffer to redraw the window, say, if you resize it, or scroll the text up and down.

This text buffer belongs to xterm. It is not accessible to your application. The highlighting is done in this buffer, by xterm.

All you input and output goes through xterm (as long as your focus is in the xterm window). xterm knows where you click your mouse, and knows the size of character cells in its window (they are all the same, at least in classic xterm). Calculating from the mouse coordinates which character cell was clicked is trivial. (If you use variable-width font, it is just semi-trivial.) xterm starts at from this character and looks at the preceding and following characters in its text buffer. As long as they are 'word characters', it adds highlight to it and searches forward, but stops on whitespace, punctuation etc.

If you could monitor the connection between xterm and your application when you mark the word, you would see none. The marking is something xterm does for itself, alone.

I haven't been working with xterm for a number of years, and don't remember all the details, but like most *nix-born applications, it has a ton of options. I guess that you can tell xterm to give you all the raw input - certainly from the keyboard, so that your application can interpret copy (mark) and paste keystrokes, but maybe even mouse input. Your problem is that xterm manages its own scrolling, word wrapping etc. and your application cannot know where it has placed the output text you gave it. So even if you get the mouse click position, you don't have the information to know which word the cursor was pointing at.

If I understand your need correctly (and you do not want to give your application its own tailor made X-based user interface), the simple but somewhat pedal driven way to do it is to open a text editor with a new empty file (or one where you want to add another log record), mark the text in your xterm window, and then past them into the file in the text editor. There are multiple ways to mark text in xterm - single, double, triple click, mouse drag etc.

By *nix conventions marked text is put into the copy&paste buffer. I believe (not 100% sure) that even the Windows version of xterm is *nix like; it doesn't require any ctrl-C to copy the text. Pasting into the text editor file (or any other *nix style application) is usually done with the middle mouse button (or left, if you have no middle). If you run in Windows environment, and the text editor is a Windows application, be prepared to use ctrl-V or some menu selection to paste the text.

And again: If you monitor the communication between your application and xterm, there is no trace of the copy&paste into the text editor file. The copying is a private matter between xterm and the editor.

If you have as a requirement that your application must be aware of the copy&paste, you have to abandon xterm and straight command line output, and give your application its own X-based GUI. That will complicate it significantly. If you go for that solution, do not attempt to program at the X.11 level - that is like 'GUI assembly coding'. Find some X.11 based library / GUI platform. I haven't made a *nix GUI since Motif was the standard library, but most likely, today it has competition from about 42 alternative libraries, all open source, free for you to study the source code Smile | :)
AnswerRe: how to identify the " selected text highlights" event ? Pin
Gerry Schmitz21-Nov-22 11:02
mveGerry Schmitz21-Nov-22 11:02 
AnswerRe: how to identify the " selected text highlights" event ? Pin
Richard MacCutchan21-Nov-22 22:43
mveRichard MacCutchan21-Nov-22 22:43 
QuestionUnimplemented RAID ( 5) causing crash Pin
Member 1496877129-Aug-22 8:43
Member 1496877129-Aug-22 8:43 
QuestionLinux Ubuntu grub issues - how to resolve ? Pin
Member 1496877126-Aug-22 8:16
Member 1496877126-Aug-22 8:16 
AnswerRe: Linux Ubuntu grub issues - how to resolve ? Pin
Gerry Schmitz26-Aug-22 10:02
mveGerry Schmitz26-Aug-22 10:02 
AnswerRe: Linux Ubuntu grub issues - how to resolve ? Pin
Richard MacCutchan26-Aug-22 23:02
mveRichard MacCutchan26-Aug-22 23:02 
Questionbluetoothctl command - how to disable it ? (terminate command ) Pin
Member 1496877126-Aug-22 7:28
Member 1496877126-Aug-22 7:28 
AnswerRe: bluetoothctl command - how to disable it ? (terminate command ) Pin
Dave Kreskowiak26-Aug-22 9:56
mveDave Kreskowiak26-Aug-22 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.