Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7964265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:50:30+00:00 2026-06-04T05:50:30+00:00

I am writing a text editor using gtk+-2.0 & gtksourceview-2.0. I am having trouble

  • 0

I am writing a text editor using gtk+-2.0 & gtksourceview-2.0. I am having trouble finding a way to programmatically select a block of text and add it to the OS (linux) primary selection clipboard. Just like if I hightlighted a block of text with the mouse or held down the shift key and selected the text with the arrow key.

I have found in devhelp under “gtk_text_buffer_get_selection_bound ()” the statement:

The currently-selected text in buffer is the region between the “selection_bound” and “insert” marks.

Edit:
gtk_text_buffer_select_range (), sets the location of these two marks.

The following block of code copies, the region specified using the text iters start & end, to the primary selection clipboard (as desired):

            gtk_text_buffer_select_range (tbuffer, &start, &end); 
            GtkClipboard *cb = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
            gtk_text_buffer_copy_clipboard (tbuffer,cb);

Thanks for the ideas!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:50:31+00:00Added an answer on June 4, 2026 at 5:50 am

    Perhaps you should try gtk_editable_copy_clipboard (). The documentation says that “copies the contents of the currently selected content in the editable and puts it on the clipboard”. Then paste using gtk_editable_paste_clipboard () which “pastes the content of the clipboard to the current position of the cursor in the editable.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a text editor in C using gtk+-2.0 & gtksourceview-2.0. I'm trying
I am creating a text editor in C using gtk+-2.0 gtksourceview-2.0. I am having
i am writing a text editor in gtk 3 using python. in gtk 2
I am writing a text editor and had planned on using the richtextbox control
I am writing a text editor(in java) where I am using a JTextArea for
I'm writing a text editor using C#, I know i'm just reinventing the wheel
I'm writing a text editor and I want to add the possibility to import
I am writing a Text Editor using the Qt C++ framework. I'm using a
So, I'm writing a text editor, using MDI. I have a frame window, child
I am writing a text editor which has an option to display a bullet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.