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

  • Home
  • SEARCH
  • 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 8254647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:15:47+00:00 2026-06-08T01:15:47+00:00

I have a textbox asking for a value. How can I capture this value

  • 0

I have a textbox asking for a value. How can I capture this value and pass on this to another function?

int main (int argc, char *argv[]) {
  GtkWidget *window,*table,*label,*entry;
  gtk_init(&argc, &argv);

  //Create the main window
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  initialize_window(window);

   /* Create a 1x2 table */
   table = gtk_table_new (1, 2, TRUE);
   gtk_container_add (GTK_CONTAINER (window), table);

  /* create a new label. */
  label = gtk_label_new ("Enter some text:" );
  //gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
  gtk_table_set_homogeneous(GTK_TABLE (table), TRUE);
  gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);

  //create a text box
  //  entry = gtk_entry_new ();
  gtk_entry_set_max_length (GTK_ENTRY (entry),0);
  gtk_table_attach_defaults (GTK_TABLE (table), entry, 0, 1, 0, 1);
  gtk_widget_show_all(window);
}

Now I want to use this value and pass it to some function.

  • 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-08T01:15:50+00:00Added an answer on June 8, 2026 at 1:15 am

    Something like this should work. When the Enter key is pressed, entry_activated will be called:

    static void entry_activated(GtkEntry *entry, gpointer user_data)
    {
        int i;
        const gchar *entered = gtk_entry_get_text(entry);
    
        i = atoi(entered); // strtol() would be better, but this will work.
    
        g_message("Entry: %d", i);
    }
    
    int main (int argc, char *argv[]) {
        /* ... stuff ... */
    
        entry = gtk_entry_new();
        g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(entry_activated), NULL);
    
        /* ... stuff ... */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know its stupid asking this question but i cant seems to extra Value(int)
Im creating forum like application and I have textbox where users can enter tags
I have a textbox.T he user will be entering entering a number in this
I am creating intellisense as Java's intellisense at C#.I have TextBox which user can
I have been spying the MSDN and can't see a property/method for TextBox that
I have TextBox on my page. I want to validating this textbox. The rules
I have Textbox with blue Background and white Foreground . When entering a text
I have: Textbox(Multi-line) Panel Different controls inside panel (buttons,textbox) Scenario: I need to add
I have TextBox (multiline) and Label in an UpdatePanel which I refresh with javascript
Desktop window application. I have textbox in which user give values in numbers. what

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.