Re: How do I create a multi column popup menu



I could do that  but in this case i think it would be clearer if all options
were shown at once and
no submenus.

I do not know at compile time what entries there might be in the list.
I dont even know at runtime until I actually want to bring the popup menu up
what entries there might
be.

I dont want to sort the entries.

Some of the instances where i need to do this there is no intuitive way to
divide them into submenus and it would confuse users
to hae to search through submenus until they find the item they want.


Is it possible to create multicolumn popup menus?

----- Original Message -----
From: "Gustavo J A M Carneiro"
Sent: Saturday, August 30, 2003 12:30 AM
Subject: Re: How do I create a multi column popup menu


  Why not creating submenus (by topic, alphabetical, whatever) and sort
the menu items into one of several submenus?

A Sex, 2003-08-29 às 09:16, Ronnie Sahlberg escreveu:
Hi list.
(I am not subscribed but reads the list through the web archive
interface.)

I am one of the developers of a GPL application that uses the GTK
toolkit
(www.ethereal.com  (.com
since .org was already taken))

I have one problem now that I dont know how to solve:
Some of the popup menus in ethereal have a lot of different menu items
on
them,  so many that the menu is higher than the screen height and
thus not all of them can be seen.
I have seen applications that do popup menus that are multicolumn.

Can someone please tell me or show with a small example how I can create
a
multicolumn popup menu?
(beware  the code must support both gtk1.2 and gtk2,  we have some
compatibility macros to help do this with a single common codebase)

Dont laugh at the code,   Im not a toolkit person.  I do protocols, not
gui's.   Its based on cut-n-paste from examples.  It works.


-------
The first instance is when needing to create a popup menu at runtime.
It
is created this way since we dont know at compile time how many items
the menu will have or what they will be.  So there is some code to
create a
menu and then a loop with callbacks to add the actual entries to it:

(gtk/dcerpc_stat.c)
This snippet creates the menu and goes through an enumerator
(g_hash_table_foreach() to add all the items)
    /* Program menu */
    prog_opt=gtk_option_menu_new();
    prog_menu=gtk_menu_new();
    g_hash_table_foreach(dcerpc_uuids, (GHFunc)dcerpcstat_list_programs,
NULL);
    gtk_option_menu_set_menu(GTK_OPTION_MENU(prog_opt), prog_menu);
    gtk_box_pack_start(GTK_BOX(prog_box), prog_opt, TRUE, TRUE, 0);
    gtk_widget_show(prog_opt);

The individual menu items are added as :
    menu_item=gtk_menu_item_new_with_label(v->name);
    SIGNAL_CONNECT(menu_item, "activate", dcerpcstat_program_select, k);
    gtk_widget_show(menu_item);
    gtk_menu_append(GTK_MENU(prog_menu), menu_item);


Question:   How can I up in the snippet above specify that there should
be a
vertical separator to split the menu in two (or more) columns?



thanks for any response
    ronnie sahlberg



_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Gustavo J. A. M. Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]