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 7161175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:31:21+00:00 2026-05-28T13:31:21+00:00

I have runtime-created menu based on words in selected gtkTreeView row. gboolean menu_RELEASE(GtkObject *object,

  • 0

I have runtime-created menu based on words in selected gtkTreeView row.

gboolean
menu_RELEASE(GtkObject *object, GdkEvent *event, gpointer user_data)
{
    if (strlen(user_data) > 0)
    {
        gtk_entry_set_text(GTK_ENTRY(entry1), user_data);
        gtk_widget_grab_focus(entry1);
    }
    else
        main_art(get_sifra());

    return TRUE;
}

gboolean
treeview1_BUTTONRELEASE(GtkWidget *widget, GdkEventButton *event, gpointer *user_data)
{
    if (event->type == GDK_BUTTON_RELEASE && event->button == 3)
    {
        char *ntext;
        treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
        if (gtk_tree_selection_get_selected(treesel, &model ,&iter))
        {
            gtk_tree_model_get(model, &iter, cNaziv, &ntext, -1);
            GtkWidget *menu, *menu_item;
            menu = gtk_menu_new();

            char *sresult = NULL;
            sresult = strtok(ntext, " ");
            while(sresult != NULL)
            {
                if (strlen(sresult)>1)
                {
                    menu_item = gtk_menu_item_new_with_label(sresult);
                    gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
                    g_signal_connect(G_OBJECT(menu_item), "button-release-event", G_CALLBACK(menu_RELEASE), (gpointer)sresult);
                }
                sresult = strtok(NULL, " ");
            }

            menu_item = gtk_separator_menu_item_new();
            gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
            //
            menu_item = gtk_image_menu_item_new_with_label("Uredi...");
            gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), GTK_WIDGET(gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU)));
            gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
            g_signal_connect(G_OBJECT(menu_item), "button-release-event", G_CALLBACK(menu_RELEASE), (gpointer)"");
            //
            gtk_widget_show_all(menu);
            gtk_menu_popup(GTK_MENU(menu), NULL, NULL,  NULL, NULL, 0, gtk_get_current_event_time());
            return TRUE;
        }
    }
    return FALSE;
}

When menu item was released action from “menu_RELEASE” should appear.
But what happened?
Menu don’t dissappear, stay’s visible and active.

What is wrong with my code?

  • 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-05-28T13:31:22+00:00Added an answer on May 28, 2026 at 1:31 pm

    You’re not supposed to connect to mouse-button signals of the items, that’s being too low-level. Your handler is “swallowing” the mouse button signal, preventing GTK+ from handling it.

    Use the activate signal.

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

Sidebar

Related Questions

I have written a runtime-created dialog class that doesn't use any resource files based
Hello I have a Dynamic DataTable Created at runtime. The Setup is like so
Suppose I have a storyboard, created at runtime by some process, containing keyframe animations.
I have instantiated several System.Drawing.Icon Objects. Note that these are created at runtime and
I have 2 dimensional list created at runtime (the number of entries in either
I have a dynamically created (runtime creation) textbox whose name is available as a
In Java, an Object can have a runtime type (which is what it was
I have problem on deleting component which is created on runtime. Please help me.
Hy, I have a chart,wich is created in runtime,this could be Line, Bar or
I have a View that was created at runtime then I draw some canvas

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.