Set number of visible items for GtkComboBox
Hi, ALL, In Windows it is achievable thru https://msdn.microsoft.com/en-us/library/windows/desktop/bb775915(v=vs.85).aspx. In OSX/Cocoa - thru https://developer.apple.com/documentation/appkit/nscombobox/1436741-numberofvisibleitems. Is there a way to do that for GTK+ 2 and 3? Thank you. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox: different length of lists
Hi there, I use GtkComboBox with different length of lists. Seems to me that GTK takes the longest list as base and fills up shorter lists with zero's (see attached image). How can I avoid these zero's on display? Here's the part for the liststore in the ui-file: 2 2 2 2 2 5 5 5 5 5 10 10 10 10 20 20 20 20 50 50 50 50 100 100 100 200 200 200 500 500 500 1000 1000 2000 2000 5000 5000 1 2 5 _ Axel ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
RE: GtkComboBox with appears-as-list - broken? going away?
> -Original Message- > From: Ian Puleston [mailto:i...@underpressuredivers.com] > Sent: Tuesday, December 13, 2016 1:15 PM > > Thanks. I found this bug report opened a couple of years ago which seems to > be the same thing that I'm seeing with appears-as-list set: > > https://bugzilla.gnome.org/show_bug.cgi?id=743683 > > If I can reproduce this in a Linux version as well as in the Windows version > then I might look into possibly fixing it if I get some time. This was difficult but I eventually found the problem and now have GtkComboBox with "appears-as-list" working again under GTK 3.22. I can supply a patch but one quick question: should I submit it with the bug report above, or would it be better to open a new one to get some visibility since that one hasn’t seen any activity in two years? > > > -Original Message- > > From: Emmanuele Bassi [mailto:eba...@gmail.com] > > Sent: Tuesday, December 13, 2016 12:53 PM > > > > Hi; > > > > you probably wanted to send you email to gtk-devel-list. Apologies if this is slightly off subject on this list. > > > > On 13 December 2016 at 20:08, Ian Puleston > > > > wrote: > > >> I added in CSS to programmatically set “appears-as-list”, and that worked >> OK but the resultant list style combo box does not now seem to be working >> any more. It looks right, but does not respond to mouse clicks or >> scroll-wheel >> movement in the list. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: Question about GtkComboBox
Hi, Robert, On Fri, Jan 20, 2012 at 12:31 AM, Robert Pearce wrote: > On Thu, 19 Jan 2012 22:46:30 -0800 Igor wrote: >> Hi, ALL, >> I am using GtkComboBox and I need to show the dropdown >> list in my program. >> >> I found a function gtk_combo_box_popup() but the documentation >> says that it should be used for the accessibility purposes. >> >> Does this mean I can't use it? And if I can't what are the drawbacks? > > I don't know if this was the intent, but I've always interpreted that > note as meaning you shouldn't normally ever need to programmatically > show the drop-down because when the user wants to see it she will click > on the arrow and GTK will take care of it. The author could think of > one obvious exception, which was a user whose disability prevented use > of the mouse, who might then need some accessibility tool to drive the > UI in other ways. > > Assuming you have a good reason to deviate from the usual paradigm of > comboboxes then I don't think that note was intended to ban your use of > that function. It is, possibly, intended to encourage you to consider > carefully whether you really want to break the paradigm. I can think of one example where it could be useful. I think I read about it in one of the books. The book called "Visual C++ MFC Programming by Example". I'm talking about dynamically filling the combo box. I can catch the "notification:popdown/popup" signal, but if I want to write a unit test for this I should be able to imitate this behaviour programmatically. Now in case the user of my program is disabled there is a special library I can link with and use that will allow to work with such features of GTK+. Am I right? Thank you. > > HTH > Rob > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Question about GtkComboBox
On Thu, 19 Jan 2012 22:46:30 -0800 Igor wrote: > Hi, ALL, > I am using GtkComboBox and I need to show the dropdown > list in my program. > > I found a function gtk_combo_box_popup() but the documentation > says that it should be used for the accessibility purposes. > > Does this mean I can't use it? And if I can't what are the drawbacks? I don't know if this was the intent, but I've always interpreted that note as meaning you shouldn't normally ever need to programmatically show the drop-down because when the user wants to see it she will click on the arrow and GTK will take care of it. The author could think of one obvious exception, which was a user whose disability prevented use of the mouse, who might then need some accessibility tool to drive the UI in other ways. Assuming you have a good reason to deviate from the usual paradigm of comboboxes then I don't think that note was intended to ban your use of that function. It is, possibly, intended to encourage you to consider carefully whether you really want to break the paradigm. HTH Rob ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Question about GtkComboBox
And another question. If I call gtk_combo_box_set_button_sensitivity() with GTK_SENSITIVITY_ON does this mean I will be able to catch a mouse clicks on the dropdown button at any point of time? Thank you. On Thu, Jan 19, 2012 at 10:46 PM, Igor Korot wrote: > Hi, ALL, > I am using GtkComboBox and I need to show the dropdown > list in my program. > > I found a function gtk_combo_box_popup() but the documentation > says that it should be used for the accessibility purposes. > > Does this mean I can't use it? And if I can't what are the drawbacks? > Is there another way to show the dropdown of the combo box? > > Thank you. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Question about GtkComboBox
Hi, ALL, I am using GtkComboBox and I need to show the dropdown list in my program. I found a function gtk_combo_box_popup() but the documentation says that it should be used for the accessibility purposes. Does this mean I can't use it? And if I can't what are the drawbacks? Is there another way to show the dropdown of the combo box? Thank you. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
resize a gtkcombobox
i have a gtkcombobox with a gtktreemodel i initially fill the gtktreemodel with some strings, but while running the application these strings change but the gtkcombobox remains of the width of the longest of these strings and not of the width of the longest currently present in the model is there a function to request the resize of the gtkcombobox each time i empty it and then i fill it again with new strings with different length? thanks in advance ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Is it possible to display an icon and text in a GtkComboBox ?
> But something else, how can i catch the popup of the window and > populate the list box on demand? The "popup" is just a key binding > signal and fires even if the popup is visible and Alt+Down is pressed. The best way i think is to listen for "map" on the combo box menushell. J ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Is it possible to display an icon and text in a GtkComboBox ?
Hello Lothar, Tuesday, July 19, 2011, 6:19:43 AM, you wrote: LS> Hello Gtk-list, LS> I need to display an icon followed by text like for example a file type icon LS> and a file name. But i can't find a way to setup cell renderers for the GtkTreeModel i use. Okay i need to RTFM, it implements GtkCellLayout. But something else, how can i catch the popup of the window and populate the list box on demand? The "popup" is just a key binding signal and fires even if the popup is visible and Alt+Down is pressed. -- Best regards, Lotharmailto:llot...@web.de ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Is it possible to display an icon and text in a GtkComboBox ?
Hello Gtk-list, I need to display an icon followed by text like for example a file type icon and a file name. But i can't find a way to setup cell renderers for the GtkTreeModel i use. -- Best regards, Lothar mailto:llot...@web.de ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Thank you Lothar, I will try your solution. 2011/4/27 Lothar Scholz > Hello richard, > > > Wednesday, April 27, 2011, 1:11:32 PM, you wrote: > > > well, i guess i wonder how it's possible to fill in the combo box with > entries, while not being able to count them at the same time. > > > When you pass the combo box to some extensions doing the fill in this can > be problem. > Yes i know - pathetic argument - but the API should have a call for it. > > I run into the same problems when writing a cross-toolkit portability > layer. > > By the way, one way might be taking the tree model and calling the > n_children method > > > gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtk_combo_box_get_model(combo_box)),NULL); > > > *-- > Best regards, > Lotharmailto:llot...@web.de * > -- Emmanuel Mbenga Gontcho ! Gem ! gontcho.wordpress.com N'utilisez pas Windows 7. Pour savoir pourquoi : http://windows7sins.org/ Don't use Windows 7. To know why : http://windows7sins.org/ Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org Rejoignez maintenant plus de 2 500 personnes, associations, entreprises et collectivités qui soutiennent notre action ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox insanely slow on large models (GTK 2.22)
hi lothar, i'm not familiar with the details of your app, but i wonder if looking at this from the user's perspective might lead you to a way out. first, does your model assume a single list of items? or are there several levels of hierarchy involved? because when it's a single list: if, as a user, i am confronted with a combo box with 10K+ items, how am i expected to use it in a way that translates to user-friendliness? like i said, don't know your app, but a combo box with thousands of items a user is expected to select a single entry from seems, well, a little crazy. i would definitely look to breaking this up into as many levels of hierarchy as possible to make the user not go insane. (on the other hand, this doesn't necessarily solve your problem...) when, on the other hand, your model translates to combo-box lists that define several levels of hierarchy (resulting ultimately in a selection list presented to the user that is a reasonable length), then you might want to think about how to tackle the problem as part of the design. for example: - is the list data static (defined once during the lifetime of the program) or dynamic? - when static, create all the combo boxes you need at program startup and then simply attach them accordingly during the course of program execution, when and where you need them. - when dynamic, what triggers a change? - if triggered externally (i.e., not a result of user interaction), consider handling the change in the background, constructing the new models and then attaching to a new combo box widget that is used as a replacement the next time the combo box is requested. - if triggered by the user, there's not a lot (i think) you can do about GTK+ internals and how this particular processing has been designed and implemented. my app constructs combo-box lists, some quite large, so when the user dis-connects and re-connects from/to different databases, many, many data models and combo-boxes must be destroyed and recreated. for me, this translates to less than a minute of time in my worst-case scenario. and so i've decided to live with this since DB switching does not iccur very frequently. that doesn't mean a different, better solution doesn't exist, i just don't know of it. richard On Wed, Apr 27, 2011 at 10:54 AM, Lothar Scholz wrote: > Hello, > > i tried to test GtkComboBox with just 1 items (not that much) and > the app becomes totally unusable. I'm using my own tree model and my > own cell renderer. > > While GtkTreeView works very well with a few ten thousand items, > GtkComboBox runs through all items multiple times when attaching > the model and displaying the list. And setting > "gtk_cell_renderer_set_fixed_size" seems not to work either, cause it > still iterates like crazy. > > Is there anything i can do about it? > > > -- > Best regards, > Lothar mailto:llot...@web.de > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox insanely slow on large models (GTK 2.22)
Hello, i tried to test GtkComboBox with just 1 items (not that much) and the app becomes totally unusable. I'm using my own tree model and my own cell renderer. While GtkTreeView works very well with a few ten thousand items, GtkComboBox runs through all items multiple times when attaching the model and displaying the list. And setting "gtk_cell_renderer_set_fixed_size" seems not to work either, cause it still iterates like crazy. Is there anything i can do about it? -- Best regards, Lothar mailto:llot...@web.de ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Title: Re: GtkComboBox Hello richard, Wednesday, April 27, 2011, 1:11:32 PM, you wrote: well, i guess i wonder how it's possible to fill in the combo box with entries, while not being able to count them at the same time. When you pass the combo box to some extensions doing the fill in this can be problem. Yes i know - pathetic argument - but the API should have a call for it. I run into the same problems when writing a cross-toolkit portability layer. By the way, one way might be taking the tree model and calling the n_children method gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtk_combo_box_get_model(combo_box)),NULL); -- Best regards, Lothar mailto:llot...@web.de ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
well, i guess i wonder how it's possible to fill in the combo box with entries, while not being able to count them at the same time. richard 2011/4/27 Emmanuel Gontcho > Hello, > > It seems to me that it is impossible to know the item count in a combobox > declared with gtk_combo_box_new_text. Somebody knows what to do ? > > -- > Emmanuel Mbenga Gontcho > ! Gem ! > > gontcho.wordpress.com > > N'utilisez pas Windows 7. Pour savoir pourquoi : http://windows7sins.org/ > Don't use Windows 7. To know why : http://windows7sins.org/ > > Membre de l'April - « promouvoir et défendre le logiciel libre » - > http://www.april.org > > Rejoignez maintenant plus de 2 500 personnes, associations, entreprises et > collectivités qui soutiennent notre action > > > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox
Hello, It seems to me that it is impossible to know the item count in a combobox declared with gtk_combo_box_new_text. Somebody knows what to do ? -- Emmanuel Mbenga Gontcho ! Gem ! gontcho.wordpress.com N'utilisez pas Windows 7. Pour savoir pourquoi : http://windows7sins.org/ Don't use Windows 7. To know why : http://windows7sins.org/ Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org Rejoignez maintenant plus de 2 500 personnes, associations, entreprises et collectivités qui soutiennent notre action ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox Text Markup
On 03/07/2011 04:50 PM, Tristan Van Berkom wrote: On Tue, Mar 8, 2011 at 6:35 AM, Vikram Ambrose wrote: On 03/03/2011 10:09 PM, Tristan Van Berkom wrote: On Fri, Mar 4, 2011 at 12:00 PM, Vikram Ambrose wrote: Hello List, How do you do pango markup for text in a GtkComboBox? - You create your combo box - Create a GtkListStore with a G_TYPE_STRING column where you store the markup for each row - Give the list store to the combo - Add a GtkCellRendererText to the combo - Assign the "markup" attribute of the cell renderer to the column in the store that holds the markup. Tada ! Thanks. I'll give it a try. Seems like massive overkill though. Couldnt this be done using a combobox made from gtk_combo_box_new_text()? I only need to store two items. No it cannot, the _text() apis are the convenience that takes care of the simple tasks such as: a.) creating a liststore to store the text b.) creating a cellrenderertext to display the text in the liststore It's just a small wrapping api that does the work for the simple case of a combo box that only shows simple text entries. Well I managed to do it like this... combo = gtk_combo_box_new_text(); cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(combo)); if(cell_list && cell_list->data){ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),cell_list->data,"markup",0,NULL); } I'm guessing this could break without notice but at the moment its a million times better than bringing in the clunky GtkTreeModel API for just two items. Thanks. V. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox Text Markup
On Tue, Mar 8, 2011 at 6:35 AM, Vikram Ambrose wrote: > On 03/03/2011 10:09 PM, Tristan Van Berkom wrote: >> >> On Fri, Mar 4, 2011 at 12:00 PM, Vikram Ambrose >> wrote: >>> >>> Hello List, >>> >>> How do you do pango markup for text in a GtkComboBox? >> >> - You create your combo box >> >> - Create a GtkListStore with a G_TYPE_STRING column where you store >> the markup for each row >> >> - Give the list store to the combo >> >> - Add a GtkCellRendererText to the combo >> >> - Assign the "markup" attribute of the cell renderer to the column >> in the store that holds the markup. >> >> Tada ! >> > > Thanks. I'll give it a try. > > Seems like massive overkill though. Couldnt this be done using a combobox > made from gtk_combo_box_new_text()? > > I only need to store two items. No it cannot, the _text() apis are the convenience that takes care of the simple tasks such as: a.) creating a liststore to store the text b.) creating a cellrenderertext to display the text in the liststore It's just a small wrapping api that does the work for the simple case of a combo box that only shows simple text entries. Cheers, -Tristan ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox Text Markup
On 03/03/2011 10:09 PM, Tristan Van Berkom wrote: On Fri, Mar 4, 2011 at 12:00 PM, Vikram Ambrose wrote: Hello List, How do you do pango markup for text in a GtkComboBox? - You create your combo box - Create a GtkListStore with a G_TYPE_STRING column where you store the markup for each row - Give the list store to the combo - Add a GtkCellRendererText to the combo - Assign the "markup" attribute of the cell renderer to the column in the store that holds the markup. Tada ! Thanks. I'll give it a try. Seems like massive overkill though. Couldnt this be done using a combobox made from gtk_combo_box_new_text()? I only need to store two items. Vik. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox Text Markup
On Fri, Mar 4, 2011 at 12:00 PM, Vikram Ambrose wrote: > Hello List, > > How do you do pango markup for text in a GtkComboBox? - You create your combo box - Create a GtkListStore with a G_TYPE_STRING column where you store the markup for each row - Give the list store to the combo - Add a GtkCellRendererText to the combo - Assign the "markup" attribute of the cell renderer to the column in the store that holds the markup. Tada ! ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox Text Markup
Hello List, How do you do pango markup for text in a GtkComboBox? Thanks, /V ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox and focus-in-event
Hi, I would like to use the "focus-in-event" and "focus-out-event" for GtkComboBox. But the signals were not called. Then I added a GtkEventBox as parent so it works for a while. But on recent GTK versions it stopped working. Any clues? Thanks in Advance, Antonio Scuri ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox popup menu wider than the combobox
On Tue, 2010-10-05 at 09:16 +0200, Michael Natterer wrote: > On Mon, 2010-10-04 at 20:46 +0200, Murray Cumming wrote: > > Is there any way to make a GtkComboBox's popup menu wider than the > > GtkComboBox itself, or to disable ellipsizing so that is possible? > > No, but the other way around. You initialize the combo with the > large cells, and then hack around to set smaller cells once > the widget is constructed. > > In GIMP, we do the hack in style_set() because we need a style > property that scales down font size, but I'm sure you can do > it in another place too: > > layout = GTK_CELL_LAYOUT (gtk_bin_get_child (GTK_BIN (combo))); > gtk_cell_layout_clear (layout); > > Then set something "small". > > No a solution, but a hack that has worked for a long time now ;) I'm glad that I'm not the only one who needs this. Would this patch (from Tristan) help you too? https://bugzilla.gnome.org/show_bug.cgi?id=631452#c4 -- murr...@murrayc.com www.murrayc.com www.openismus.com ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox popup menu wider than the combobox
On Mon, 2010-10-04 at 20:46 +0200, Murray Cumming wrote: > Is there any way to make a GtkComboBox's popup menu wider than the > GtkComboBox itself, or to disable ellipsizing so that is possible? No, but the other way around. You initialize the combo with the large cells, and then hack around to set smaller cells once the widget is constructed. In GIMP, we do the hack in style_set() because we need a style property that scales down font size, but I'm sure you can do it in another place too: layout = GTK_CELL_LAYOUT (gtk_bin_get_child (GTK_BIN (combo))); gtk_cell_layout_clear (layout); Then set something "small". No a solution, but a hack that has worked for a long time now ;) ciao, --mitch ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox popup menu wider than the combobox
On Tue, Oct 5, 2010 at 3:46 AM, Murray Cumming wrote: > Is there any way to make a GtkComboBox's popup menu wider than the > GtkComboBox itself, or to disable ellipsizing so that is possible? Unfortunately not, I've been wanting that also for Glade (particularly the cell-renderer editor does some hack that disables the ellipsizing at popup show time, but the effect is not pretty). I discussed this with Matthias briefly on irc as an "it would be nice" feature, I think essentially it needs some semantics to determine what are the limits of the popup menu to ensure the popup doesnt show up in a weird position (for instance does it align with the left side of the combo or the right side ? is there a size limit to the popup menu width at all ? possibly it should flow outside of the combo's allocation but be restrained to fit inside a parent frame or scrolled window). Cheers, -Tristan > > -- > murr...@murrayc.com > www.murrayc.com > www.openismus.com > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox popup menu wider than the combobox
Is there any way to make a GtkComboBox's popup menu wider than the GtkComboBox itself, or to disable ellipsizing so that is possible? -- murr...@murrayc.com www.murrayc.com www.openismus.com ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox multiple rows
Hello, I'd like to setup a GtkComboBox to show a pixbuf and just below it a small string, for each element in the combox. The default behavior seems to show each item in a separate column. How do I make each time go one beneath each other instead of side-by-side? thanks, Vik. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
RE: Limit number of displayed items in GtkComboBox
Please help me... From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On Behalf Of Vishak V. Kurup Sent: Thursday, July 15, 2010 12:03 PM To: gtk-list@gnome.org Subject: Limit number of displayed items in GtkComboBox Hi, Does anyone know how to limit the number of items displayed when a combobox list is displayed. Currently it expands upto bottom of the screen. Regards Vishak * Confidentiality Statement/Disclaimer * This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt. The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Limit number of displayed items in GtkComboBox
Hi, Does anyone know how to limit the number of items displayed when a combobox list is displayed. Currently it expands upto bottom of the screen. Regards Vishak * Confidentiality Statement/Disclaimer * This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt. The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Hi all, I also needed the liststore implementation of a Combo for a different reason (I could not find a way to to make the simple Combo tell me the number of items currently in the list. With a list store implementation this is simply n = gtk_tree_model_iter_n_children ( (GtkTreeModel *)store , NULL );). I confirm what Tadej was mentioning... After moving the data into the liststore the following work for setting the active selection: GtkTreeIter iter ; char pathstring [ 20 ] ; sprintf ( pathstring , "%d" , selix ) ; gtk_tree_model_get_iter_from_string ((GtkTreeModel *)store, &iter, pathstring); gtk_combo_box_set_active_iter ((GtkComboBox *)c, &iter ) ; This works too: gtk_combo_box_set_active ((GtkComboBox *)c, selix ) ; Ken --- On Fri, 25/6/10, Tadej Borovšak wrote: From: Tadej Borovšak Subject: Re: gtkcombobox with self internal code to the options To: "John Williams" Cc: gtk-list@gnome.org Date: Friday, 25 June, 2010, 2:39 AM Hi. > Shall I beg? Maybe you should attach a check to your mail. ;-) Seriously, sorry for this delay. gtk_combo_box_set_active() will work just fine. If you have iter, you can also use gtk_combo_box_set_active_iter(). Tadej -- Tadej Borovšak tadeboro.blogspot.com tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: RE: gtkcombobox with self internal code to the options
Woah, Like a commandment. Although I understand the sentiment. On Jun 24, 2010 11:41am, Jeff Hallock wrote: You shall RTFM and try it out yourself. -Original Message- From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On Behalf Of John Williams Sent: Thursday, June 24, 2010 2:08 PM To: Tadej Borovšak Cc: gtk-list@gnome.org Subject: Re: gtkcombobox with self internal code to the options Shall I beg? 2010/6/21 John Williams asb1...@gmail.com>: > Anyone? > > 2010/6/16 John Williams asb1...@gmail.com>: >> Other question, how can I set the active option? gtk_combo_box_set_active? >> >> 2010/6/16 John Williams asb1...@gmail.com>: >>> Yes Tadej, you understand perfectly. >>> >>> Thank you for the example! >>> >>> 2010/6/15 Tadej Borovšak tadeb...@gmail.com>: >>>> Hello. >>>> >>>> If I understand you correctly, you want to store name and ID of your >>>> field inside combo box and retrieve it when needed. If this is true, >>>> have a look at this snippet of code that demonstrates how to do this: >>>> >>>> --- >>>> #include >>>> >>>> enum >>>> { >>>> COL_NAME, >>>> COL_ID, >>>> NO_COLS >>>> }; >>>> >>>> static void >>>> cb_changed (GtkComboBox *combo) >>>> { >>>> GtkTreeIter iter; >>>> GtkTreeModel *model; >>>> gint id; >>>> gchar *name; >>>> >>>> gtk_combo_box_get_active_iter (combo, &iter); >>>> model = gtk_combo_box_get_model (combo); >>>> gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); >>>> >>>> g_print ("Active selection: %s (id: %d)\n", name, id); >>>> g_free (name); >>>> } >>>> >>>> int >>>> main (int argc, >>>> char **argv) >>>> { >>>> GtkWidget *window, >>>> *combo; >>>> GtkCellRenderer *cell; >>>> GtkListStore *store; >>>> gint i; >>>> >>>> gtk_init (&argc, &argv); >>>> >>>> window = gtk_window_new (GTK_WINDOW_TOPLEVEL); >>>> g_signal_connect (window, "destroy", gtk_main_quit, NULL); >>>> >>>> store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); >>>> for (i = 0; i >>>> { >>>> GtkTreeIter iter; >>>> gchar name[] = "Item "; >>>> >>>> name[5] = '0' + i; >>>> gtk_list_store_append (store, &iter); >>>> gtk_list_store_set (store, &iter, COL_NAME, name, >>>> COL_ID, g_random_int (), >>>> -1); >>>> } >>>> >>>> combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); >>>> g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); >>>> gtk_container_add (GTK_CONTAINER (window), combo); >>>> >>>> cell = gtk_cell_renderer_text_new (); >>>> gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); >>>> gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, >>>> "text", COL_NAME); >>>> >>>> gtk_widget_show_all (window); >>>> >>>> gtk_main(); >>>> >>>> return 0; >>>> } >>>> -- >>>> >>>> Tadej >>>> >>>> -- >>>> Tadej Borovšak >>>> tadeboro.blogspot.com >>>> tadeb...@gmail.com >>>> tadej.borov...@gmail.com >>>> >>> >> > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
RE: gtkcombobox with self internal code to the options
You shall RTFM and try it out yourself. -Original Message- From: gtk-list-boun...@gnome.org [mailto:gtk-list-boun...@gnome.org] On Behalf Of John Williams Sent: Thursday, June 24, 2010 2:08 PM To: Tadej Borovšak Cc: gtk-list@gnome.org Subject: Re: gtkcombobox with self internal code to the options Shall I beg? 2010/6/21 John Williams : > Anyone? > > 2010/6/16 John Williams : >> Other question, how can I set the active option? gtk_combo_box_set_active? >> >> 2010/6/16 John Williams : >>> Yes Tadej, you understand perfectly. >>> >>> Thank you for the example! >>> >>> 2010/6/15 Tadej Borovšak : >>>> Hello. >>>> >>>> If I understand you correctly, you want to store name and ID of your >>>> field inside combo box and retrieve it when needed. If this is true, >>>> have a look at this snippet of code that demonstrates how to do this: >>>> >>>> --- >>>> #include >>>> >>>> enum >>>> { >>>> COL_NAME, >>>> COL_ID, >>>> NO_COLS >>>> }; >>>> >>>> static void >>>> cb_changed (GtkComboBox *combo) >>>> { >>>> GtkTreeIter iter; >>>> GtkTreeModel *model; >>>> gint id; >>>> gchar *name; >>>> >>>> gtk_combo_box_get_active_iter (combo, &iter); >>>> model = gtk_combo_box_get_model (combo); >>>> gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); >>>> >>>> g_print ("Active selection: %s (id: %d)\n", name, id); >>>> g_free (name); >>>> } >>>> >>>> int >>>> main (int argc, >>>> char **argv) >>>> { >>>> GtkWidget *window, >>>> *combo; >>>> GtkCellRenderer *cell; >>>> GtkListStore *store; >>>> gint i; >>>> >>>> gtk_init (&argc, &argv); >>>> >>>> window = gtk_window_new (GTK_WINDOW_TOPLEVEL); >>>> g_signal_connect (window, "destroy", gtk_main_quit, NULL); >>>> >>>> store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); >>>> for (i = 0; i < 10; i++) >>>> { >>>> GtkTreeIter iter; >>>> gchar name[] = "Item "; >>>> >>>> name[5] = '0' + i; >>>> gtk_list_store_append (store, &iter); >>>> gtk_list_store_set (store, &iter, COL_NAME, name, >>>> COL_ID, g_random_int (), >>>> -1); >>>> } >>>> >>>> combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); >>>> g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); >>>> gtk_container_add (GTK_CONTAINER (window), combo); >>>> >>>> cell = gtk_cell_renderer_text_new (); >>>> gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); >>>> gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, >>>> "text", COL_NAME); >>>> >>>> gtk_widget_show_all (window); >>>> >>>> gtk_main(); >>>> >>>> return 0; >>>> } >>>> -- >>>> >>>> Tadej >>>> >>>> -- >>>> Tadej Borovšak >>>> tadeboro.blogspot.com >>>> tadeb...@gmail.com >>>> tadej.borov...@gmail.com >>>> >>> >> > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Hi. > Shall I beg? Maybe you should attach a check to your mail. ;-) Seriously, sorry for this delay. gtk_combo_box_set_active() will work just fine. If you have iter, you can also use gtk_combo_box_set_active_iter(). Tadej -- Tadej Borovšak tadeboro.blogspot.com tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
You shall not beg, but you should test ;-) Yes, you can set the active option with the 'gtk_combo_box_set_active' or 'gtk_combo_box_set_active_iter'. On Thu, Jun 24, 2010 at 3:07 PM, John Williams wrote: > Shall I beg? > > 2010/6/21 John Williams : > > Anyone? > > > > 2010/6/16 John Williams : > >> Other question, how can I set the active option? > gtk_combo_box_set_active? > >> > >> 2010/6/16 John Williams : > >>> Yes Tadej, you understand perfectly. > >>> > >>> Thank you for the example! > >>> > >>> 2010/6/15 Tadej Borovšak : > >>>> Hello. > >>>> > >>>> If I understand you correctly, you want to store name and ID of your > >>>> field inside combo box and retrieve it when needed. If this is true, > >>>> have a look at this snippet of code that demonstrates how to do this: > >>>> > >>>> --- > >>>> #include > >>>> > >>>> enum > >>>> { > >>>> COL_NAME, > >>>> COL_ID, > >>>> NO_COLS > >>>> }; > >>>> > >>>> static void > >>>> cb_changed (GtkComboBox *combo) > >>>> { > >>>> GtkTreeIter iter; > >>>> GtkTreeModel *model; > >>>> gint id; > >>>> gchar*name; > >>>> > >>>> gtk_combo_box_get_active_iter (combo, &iter); > >>>> model = gtk_combo_box_get_model (combo); > >>>> gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); > >>>> > >>>> g_print ("Active selection: %s (id: %d)\n", name, id); > >>>> g_free (name); > >>>> } > >>>> > >>>> int > >>>> main (intargc, > >>>> char **argv) > >>>> { > >>>> GtkWidget *window, > >>>> *combo; > >>>> GtkCellRenderer *cell; > >>>> GtkListStore*store; > >>>> gint i; > >>>> > >>>> gtk_init (&argc, &argv); > >>>> > >>>> window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > >>>> g_signal_connect (window, "destroy", gtk_main_quit, NULL); > >>>> > >>>> store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); > >>>> for (i = 0; i < 10; i++) > >>>>{ > >>>> GtkTreeIter iter; > >>>> gchar name[] = "Item "; > >>>> > >>>> name[5] = '0' + i; > >>>> gtk_list_store_append (store, &iter); > >>>> gtk_list_store_set (store, &iter, COL_NAME, name, > >>>>COL_ID, g_random_int (), > >>>>-1); > >>>>} > >>>> > >>>> combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); > >>>> g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); > >>>> gtk_container_add (GTK_CONTAINER (window), combo); > >>>> > >>>> cell = gtk_cell_renderer_text_new (); > >>>> gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); > >>>> gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, > >>>> "text", COL_NAME); > >>>> > >>>> gtk_widget_show_all (window); > >>>> > >>>> gtk_main(); > >>>> > >>>> return 0; > >>>> } > >>>> -- > >>>> > >>>> Tadej > >>>> > >>>> -- > >>>> Tadej Borovšak > >>>> tadeboro.blogspot.com > >>>> tadeb...@gmail.com > >>>> tadej.borov...@gmail.com > >>>> > >>> > >> > > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Shall I beg? 2010/6/21 John Williams : > Anyone? > > 2010/6/16 John Williams : >> Other question, how can I set the active option? gtk_combo_box_set_active? >> >> 2010/6/16 John Williams : >>> Yes Tadej, you understand perfectly. >>> >>> Thank you for the example! >>> >>> 2010/6/15 Tadej Borovšak : >>>> Hello. >>>> >>>> If I understand you correctly, you want to store name and ID of your >>>> field inside combo box and retrieve it when needed. If this is true, >>>> have a look at this snippet of code that demonstrates how to do this: >>>> >>>> --- >>>> #include >>>> >>>> enum >>>> { >>>> COL_NAME, >>>> COL_ID, >>>> NO_COLS >>>> }; >>>> >>>> static void >>>> cb_changed (GtkComboBox *combo) >>>> { >>>> GtkTreeIter iter; >>>> GtkTreeModel *model; >>>> gint id; >>>> gchar *name; >>>> >>>> gtk_combo_box_get_active_iter (combo, &iter); >>>> model = gtk_combo_box_get_model (combo); >>>> gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); >>>> >>>> g_print ("Active selection: %s (id: %d)\n", name, id); >>>> g_free (name); >>>> } >>>> >>>> int >>>> main (int argc, >>>> char **argv) >>>> { >>>> GtkWidget *window, >>>> *combo; >>>> GtkCellRenderer *cell; >>>> GtkListStore *store; >>>> gint i; >>>> >>>> gtk_init (&argc, &argv); >>>> >>>> window = gtk_window_new (GTK_WINDOW_TOPLEVEL); >>>> g_signal_connect (window, "destroy", gtk_main_quit, NULL); >>>> >>>> store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); >>>> for (i = 0; i < 10; i++) >>>> { >>>> GtkTreeIter iter; >>>> gchar name[] = "Item "; >>>> >>>> name[5] = '0' + i; >>>> gtk_list_store_append (store, &iter); >>>> gtk_list_store_set (store, &iter, COL_NAME, name, >>>> COL_ID, g_random_int (), >>>> -1); >>>> } >>>> >>>> combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); >>>> g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); >>>> gtk_container_add (GTK_CONTAINER (window), combo); >>>> >>>> cell = gtk_cell_renderer_text_new (); >>>> gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); >>>> gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, >>>> "text", COL_NAME); >>>> >>>> gtk_widget_show_all (window); >>>> >>>> gtk_main(); >>>> >>>> return 0; >>>> } >>>> -- >>>> >>>> Tadej >>>> >>>> -- >>>> Tadej Borovšak >>>> tadeboro.blogspot.com >>>> tadeb...@gmail.com >>>> tadej.borov...@gmail.com >>>> >>> >> > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Anyone? 2010/6/16 John Williams : > Other question, how can I set the active option? gtk_combo_box_set_active? > > 2010/6/16 John Williams : >> Yes Tadej, you understand perfectly. >> >> Thank you for the example! >> >> 2010/6/15 Tadej Borovšak : >>> Hello. >>> >>> If I understand you correctly, you want to store name and ID of your >>> field inside combo box and retrieve it when needed. If this is true, >>> have a look at this snippet of code that demonstrates how to do this: >>> >>> --- >>> #include >>> >>> enum >>> { >>> COL_NAME, >>> COL_ID, >>> NO_COLS >>> }; >>> >>> static void >>> cb_changed (GtkComboBox *combo) >>> { >>> GtkTreeIter iter; >>> GtkTreeModel *model; >>> gint id; >>> gchar *name; >>> >>> gtk_combo_box_get_active_iter (combo, &iter); >>> model = gtk_combo_box_get_model (combo); >>> gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); >>> >>> g_print ("Active selection: %s (id: %d)\n", name, id); >>> g_free (name); >>> } >>> >>> int >>> main (int argc, >>> char **argv) >>> { >>> GtkWidget *window, >>> *combo; >>> GtkCellRenderer *cell; >>> GtkListStore *store; >>> gint i; >>> >>> gtk_init (&argc, &argv); >>> >>> window = gtk_window_new (GTK_WINDOW_TOPLEVEL); >>> g_signal_connect (window, "destroy", gtk_main_quit, NULL); >>> >>> store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); >>> for (i = 0; i < 10; i++) >>> { >>> GtkTreeIter iter; >>> gchar name[] = "Item "; >>> >>> name[5] = '0' + i; >>> gtk_list_store_append (store, &iter); >>> gtk_list_store_set (store, &iter, COL_NAME, name, >>> COL_ID, g_random_int (), >>> -1); >>> } >>> >>> combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); >>> g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); >>> gtk_container_add (GTK_CONTAINER (window), combo); >>> >>> cell = gtk_cell_renderer_text_new (); >>> gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); >>> gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, >>> "text", COL_NAME); >>> >>> gtk_widget_show_all (window); >>> >>> gtk_main(); >>> >>> return 0; >>> } >>> -- >>> >>> Tadej >>> >>> -- >>> Tadej Borovšak >>> tadeboro.blogspot.com >>> tadeb...@gmail.com >>> tadej.borov...@gmail.com >>> >> > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Other question, how can I set the active option? gtk_combo_box_set_active? 2010/6/16 John Williams : > Yes Tadej, you understand perfectly. > > Thank you for the example! > > 2010/6/15 Tadej Borovšak : >> Hello. >> >> If I understand you correctly, you want to store name and ID of your >> field inside combo box and retrieve it when needed. If this is true, >> have a look at this snippet of code that demonstrates how to do this: >> >> --- >> #include >> >> enum >> { >> COL_NAME, >> COL_ID, >> NO_COLS >> }; >> >> static void >> cb_changed (GtkComboBox *combo) >> { >> GtkTreeIter iter; >> GtkTreeModel *model; >> gint id; >> gchar *name; >> >> gtk_combo_box_get_active_iter (combo, &iter); >> model = gtk_combo_box_get_model (combo); >> gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); >> >> g_print ("Active selection: %s (id: %d)\n", name, id); >> g_free (name); >> } >> >> int >> main (int argc, >> char **argv) >> { >> GtkWidget *window, >> *combo; >> GtkCellRenderer *cell; >> GtkListStore *store; >> gint i; >> >> gtk_init (&argc, &argv); >> >> window = gtk_window_new (GTK_WINDOW_TOPLEVEL); >> g_signal_connect (window, "destroy", gtk_main_quit, NULL); >> >> store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); >> for (i = 0; i < 10; i++) >> { >> GtkTreeIter iter; >> gchar name[] = "Item "; >> >> name[5] = '0' + i; >> gtk_list_store_append (store, &iter); >> gtk_list_store_set (store, &iter, COL_NAME, name, >> COL_ID, g_random_int (), >> -1); >> } >> >> combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); >> g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); >> gtk_container_add (GTK_CONTAINER (window), combo); >> >> cell = gtk_cell_renderer_text_new (); >> gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); >> gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, >> "text", COL_NAME); >> >> gtk_widget_show_all (window); >> >> gtk_main(); >> >> return 0; >> } >> -- >> >> Tadej >> >> -- >> Tadej Borovšak >> tadeboro.blogspot.com >> tadeb...@gmail.com >> tadej.borov...@gmail.com >> > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Yes Tadej, you understand perfectly. Thank you for the example! 2010/6/15 Tadej Borovšak : > Hello. > > If I understand you correctly, you want to store name and ID of your > field inside combo box and retrieve it when needed. If this is true, > have a look at this snippet of code that demonstrates how to do this: > > --- > #include > > enum > { > COL_NAME, > COL_ID, > NO_COLS > }; > > static void > cb_changed (GtkComboBox *combo) > { > GtkTreeIter iter; > GtkTreeModel *model; > gint id; > gchar *name; > > gtk_combo_box_get_active_iter (combo, &iter); > model = gtk_combo_box_get_model (combo); > gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); > > g_print ("Active selection: %s (id: %d)\n", name, id); > g_free (name); > } > > int > main (int argc, > char **argv) > { > GtkWidget *window, > *combo; > GtkCellRenderer *cell; > GtkListStore *store; > gint i; > > gtk_init (&argc, &argv); > > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > g_signal_connect (window, "destroy", gtk_main_quit, NULL); > > store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); > for (i = 0; i < 10; i++) > { > GtkTreeIter iter; > gchar name[] = "Item "; > > name[5] = '0' + i; > gtk_list_store_append (store, &iter); > gtk_list_store_set (store, &iter, COL_NAME, name, > COL_ID, g_random_int (), > -1); > } > > combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); > g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); > gtk_container_add (GTK_CONTAINER (window), combo); > > cell = gtk_cell_renderer_text_new (); > gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); > gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, > "text", COL_NAME); > > gtk_widget_show_all (window); > > gtk_main(); > > return 0; > } > -- > > Tadej > > -- > Tadej Borovšak > tadeboro.blogspot.com > tadeb...@gmail.com > tadej.borov...@gmail.com > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtkcombobox with self internal code to the options
Hello. If I understand you correctly, you want to store name and ID of your field inside combo box and retrieve it when needed. If this is true, have a look at this snippet of code that demonstrates how to do this: --- #include enum { COL_NAME, COL_ID, NO_COLS }; static void cb_changed (GtkComboBox *combo) { GtkTreeIter iter; GtkTreeModel *model; gint id; gchar*name; gtk_combo_box_get_active_iter (combo, &iter); model = gtk_combo_box_get_model (combo); gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_ID, &id, -1); g_print ("Active selection: %s (id: %d)\n", name, id); g_free (name); } int main (intargc, char **argv) { GtkWidget *window, *combo; GtkCellRenderer *cell; GtkListStore*store; gint i; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", gtk_main_quit, NULL); store = gtk_list_store_new (NO_COLS, G_TYPE_STRING, G_TYPE_INT); for (i = 0; i < 10; i++) { GtkTreeIter iter; gchar name[] = "Item "; name[5] = '0' + i; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, name, COL_ID, g_random_int (), -1); } combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); g_signal_connect (combo, "changed", G_CALLBACK (cb_changed), NULL); gtk_container_add (GTK_CONTAINER (window), combo); cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, "text", COL_NAME); gtk_widget_show_all (window); gtk_main(); return 0; } -- Tadej -- Tadej Borovšak tadeboro.blogspot.com tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
gtkcombobox with self internal code to the options
Hi all, Is possible use self codes to substitute the serial code that identify the options of a GtkComboBox? My problem in a simple explanation: I have a sqlite table with two columns, the id and the name, but the id isn't serial. To easily the load and save process of my screen will be so good if the table code (id column) substitute the serial code used that identify the options of the combo box. Have a way to do this? Thanks! ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GTKComboBox (space between text and button)
Hi, I use default theme in UBUNTU 9.04 (HUMAN). But I want my GTKComboBox to be the same appereance as GTKComboboxEntry. So I edited gtkrc and add the following style "combobox_style" { GtkComboBox::appears-as-list = 1 } class "GtkComboBox" style "combobox_style" Now it is better but still there is two differences: 1. Space between text and button in GtkComboBox. 2. GtkComboBox arrow button is not rounded at the top-right and bottom-right like in GtkComboBoxEntry. What is the solution? ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Manipulating a GtkComboBox like a GtkTreeView.
I've got a GtkListStore as the model for a GtkComboBox. I'd like to be able to call gtk_tree_view_set_show_lines() and gtk_tree_view_expand_all(), but obviously a GtkComboBox is not a GtkTreeView... Is it possible to do this with a GtkComboBox? If not... is there at least a way to expand certain rows? ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Modal window and GtkComboBox drop down menu not displayed properly.
Hi All, I've a modal window and a Gtk ComboBox. When the combobox is pressed the drop down looks like its going behind that window. No problems if the window containing the combobox is not modal. Has anyone observed this? I am using Gtk 2.12.2 over DirectFB 1.1.1 Regards, Harinandan S ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox question
Mike, -Original Message- >From: Mike Massonnet >Sent: Mar 11, 2009 8:52 PM >To: gtk-list@gnome.org >Cc: Igor Korot >Subject: Re: GtkComboBox question > >Le Wed, 11 Mar 2009 19:32:29 -0400 (EDT), >Igor Korot a écrit : >> So basically what I'm looking for is this code: >> >> g_signal_connect( combo->popup-shown, "notify::popup-shown", >> G_CALLBACK(...),combo); >> >> right? > >Nope, the definition is (Object, "sig-name", callback, user_data), and >combo->popup-shown is completely wrong. You want to pass the combobox. Yes. Learned it the hard way. I wish the place I'm staying for the week had a web access... ;-) > >> " >> Gets properties of an object. >> >> In general, a copy is made of the property contents and the caller is >> responsible for freeing the memory in the appropriate manner for the >> type, for instance by calling g_free() or g_object_unref(). >> " >> >> What scares me is the words "In general". So if this property is >> boolean, then according to the example that follows, I don't have to >> free the memory. But then will I have a memory leak? > >No, because you declare the boolean as a local variable. Strings are >a good example of memory you need to free. Ok, that clarifies it. > >Mike All in all I'm happy to report that this solution works. This is what you need in order to get the dropdown/closeup signals/events. A big thank you to Mike and everybody else. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox question
Le Wed, 11 Mar 2009 19:32:29 -0400 (EDT), Igor Korot a écrit : > So basically what I'm looking for is this code: > > g_signal_connect( combo->popup-shown, "notify::popup-shown", > G_CALLBACK(...),combo); > > right? Nope, the definition is (Object, "sig-name", callback, user_data), and combo->popup-shown is completely wrong. You want to pass the combobox. > " > Gets properties of an object. > > In general, a copy is made of the property contents and the caller is > responsible for freeing the memory in the appropriate manner for the > type, for instance by calling g_free() or g_object_unref(). > " > > What scares me is the words "In general". So if this property is > boolean, then according to the example that follows, I don't have to > free the memory. But then will I have a memory leak? No, because you declare the boolean as a local variable. Strings are a good example of memory you need to free. Mike ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: clicked/toggled signal for GtkComboBox
Holger, -Original Message- >From: Holger Berndt >Sent: Mar 11, 2009 6:54 PM >To: gtk-list >Subject: Re: clicked/toggled signal for GtkComboBox > >On Mi, 11.03.2009 20:32, Holger Berndt wrote: > >>Is it possible to get a notification when the user clicked on a >>GtkComboBox? That is, before the user actually makes a selection (and >>thus the "changed" signal is emitted). > >That is essentially the same question as the "GtkComboBox question" >in the thread nearby, so Mike's answer solves this, too. Yes, unless he wants to catch a general mouse click, and I want just the combo arrow button click... > >Holger Thank you. >___ >gtk-list mailing list >gtk-list@gnome.org >http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox question
Mike, -Original Message- >From: Mike Massonnet >Sent: Mar 11, 2009 5:41 PM >To: gtk-list@gnome.org >Cc: Igor Korot >Subject: Re: GtkComboBox question > >Le Wed, 11 Mar 2009 14:24:21 -0700 (GMT-07:00), >Igor Korot a écrit : > >> Mike, >> >> -Original Message- >> >From: Mike Massonnet >> >Sent: Mar 11, 2009 1:47 PM >> >To: gtk-list@gnome.org >> >Cc: Igor Korot >> >Subject: Re: GtkComboBox question >> > >> >Le Wed, 11 Mar 2009 12:54:09 -0700 (GMT-07:00), >> >Igor Korot a écrit : >SNIP > >> >> Basically I'm looking for a way to override the mouse click on the >> >> arrow for the combo box when the list either pops-up or closes >> >> down. If this is not the right event/signal, please let me know. >> > >> >I didn't try. The last time I had to hack with this case I used the >> >popdown/up signals, which was plain wrong as they work strictly with >> >the keyboard shortcuts. So you might be right with >> >notify::popup-shown. >> >> Also, do you know how do I make the function that connects to >> this signal? I was hoping to write something like this: > >http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-notify That's very helpful. Thank you. So basically what I'm looking for is this code: g_signal_connect( combo->popup-shown, "notify::popup-shown", G_CALLBACK(...),combo); right? > >> void my_func( GtkComboBox *widget, GtkScrollType scroll_type, >> gpointer user_data) { >> if( widget->popup-shown ) >> { >> // code for list shown >> } >> else >> { >> // code for list not shown >> } >> } > >You can read the popup-shown value by using g_object_get(). I don't >know how to read the value out of the GParamSpec passed in the callback. Ok. Problem is, this is what the doc says: " Gets properties of an object. In general, a copy is made of the property contents and the caller is responsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free() or g_object_unref(). " What scares me is the words "In general". So if this property is boolean, then according to the example that follows, I don't have to free the memory. But then will I have a memory leak? > >Mike Thank you. You've been a great helper so far. ;-) > >> But I don't know if this is a right prototype or not. >> And the code itself, I'm not sure if it's right as well, as I can't >> check... >> >> > >> >> Thank you. >> >> Thank you for the fast responce. >> >> > >> >Mike >> > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: clicked/toggled signal for GtkComboBox
On Mi, 11.03.2009 20:32, Holger Berndt wrote: >Is it possible to get a notification when the user clicked on a >GtkComboBox? That is, before the user actually makes a selection (and >thus the "changed" signal is emitted). That is essentially the same question as the "GtkComboBox question" in the thread nearby, so Mike's answer solves this, too. Holger ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox question
Le Wed, 11 Mar 2009 14:24:21 -0700 (GMT-07:00), Igor Korot a écrit : > Mike, > > -Original Message- > >From: Mike Massonnet > >Sent: Mar 11, 2009 1:47 PM > >To: gtk-list@gnome.org > >Cc: Igor Korot > >Subject: Re: GtkComboBox question > > > >Le Wed, 11 Mar 2009 12:54:09 -0700 (GMT-07:00), > >Igor Korot a écrit : SNIP > >> Basically I'm looking for a way to override the mouse click on the > >> arrow for the combo box when the list either pops-up or closes > >> down. If this is not the right event/signal, please let me know. > > > >I didn't try. The last time I had to hack with this case I used the > >popdown/up signals, which was plain wrong as they work strictly with > >the keyboard shortcuts. So you might be right with > >notify::popup-shown. > > Also, do you know how do I make the function that connects to > this signal? I was hoping to write something like this: http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-notify > void my_func( GtkComboBox *widget, GtkScrollType scroll_type, > gpointer user_data) { > if( widget->popup-shown ) > { > // code for list shown > } > else > { > // code for list not shown > } > } You can read the popup-shown value by using g_object_get(). I don't know how to read the value out of the GParamSpec passed in the callback. Mike > But I don't know if this is a right prototype or not. > And the code itself, I'm not sure if it's right as well, as I can't > check... > > > > >> Thank you. > > Thank you for the fast responce. > > > > >Mike > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox question
Mike, -Original Message- >From: Mike Massonnet >Sent: Mar 11, 2009 1:47 PM >To: gtk-list@gnome.org >Cc: Igor Korot >Subject: Re: GtkComboBox question > >Le Wed, 11 Mar 2009 12:54:09 -0700 (GMT-07:00), >Igor Korot a écrit : > >> Hi, ALL, >> I am looking at this page: >> http://library.gnome.org/devel/gtk/stable/GtkComboBox.html. >> >> There is a "popup-shown" property that reads: >> >> " >> Whether the combo boxes dropdown is popped up. Note that this >> property is mainly useful, because it allows you to connect to >> notify::popup-shown. >> >> Default value: FALSE >> >> Since 2.10 >> " >> However I can't find the documentation about "notify::popup-shown" >> signal/event. > >It's there in the properties. You can connect to every property by >using the signal name "notify::". Well, if you pick up an event/signal from the same page it has the function definition for it. For example: voiduser_function (GtkComboBox *widget, GtkScrollType scroll_type, gpointer user_data): Run Last / Action I was kind of hoping to get something like this for this signal. > >> Basically I'm looking for a way to override the mouse click on the >> arrow for the combo box when the list either pops-up or closes down. >> If this is not the right event/signal, please let me know. > >I didn't try. The last time I had to hack with this case I used the >popdown/up signals, which was plain wrong as they work strictly with >the keyboard shortcuts. So you might be right with notify::popup-shown. Also, do you know how do I make the function that connects to this signal? I was hoping to write something like this: void my_func( GtkComboBox *widget, GtkScrollType scroll_type, gpointer user_data) { if( widget->popup-shown ) { // code for list shown } else { // code for list not shown } } But I don't know if this is a right prototype or not. And the code itself, I'm not sure if it's right as well, as I can't check... > >> Thank you. Thank you for the fast responce. > >Mike ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox question
Le Wed, 11 Mar 2009 12:54:09 -0700 (GMT-07:00), Igor Korot a écrit : > Hi, ALL, > I am looking at this page: > http://library.gnome.org/devel/gtk/stable/GtkComboBox.html. > > There is a "popup-shown" property that reads: > > " > Whether the combo boxes dropdown is popped up. Note that this > property is mainly useful, because it allows you to connect to > notify::popup-shown. > > Default value: FALSE > > Since 2.10 > " > However I can't find the documentation about "notify::popup-shown" > signal/event. It's there in the properties. You can connect to every property by using the signal name "notify::". > Basically I'm looking for a way to override the mouse click on the > arrow for the combo box when the list either pops-up or closes down. > If this is not the right event/signal, please let me know. I didn't try. The last time I had to hack with this case I used the popdown/up signals, which was plain wrong as they work strictly with the keyboard shortcuts. So you might be right with notify::popup-shown. > Thank you. Mike ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox question
Hi, ALL, I am looking at this page: http://library.gnome.org/devel/gtk/stable/GtkComboBox.html. There is a "popup-shown" property that reads: " Whether the combo boxes dropdown is popped up. Note that this property is mainly useful, because it allows you to connect to notify::popup-shown. Default value: FALSE Since 2.10 " However I can't find the documentation about "notify::popup-shown" signal/event. Basically I'm looking for a way to override the mouse click on the arrow for the combo box when the list either pops-up or closes down. If this is not the right event/signal, please let me know. Thank you. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
clicked/toggled signal for GtkComboBox
Is it possible to get a notification when the user clicked on a GtkComboBox? That is, before the user actually makes a selection (and thus the "changed" signal is emitted). It seems to be possible to connect to the "focus-in-event", but that doesn't work when the combo box doesn't focus (gtk_combo_box_set_focus_on_click() set to FALSE). Browsing through gtk's code, it seems that what I am requesting is for the combo_box->priv->button's "clicked" or "toggled" signal to be exposed, which doesn't seem to be done currently. Am I missing something? Holger ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Multiple modal windows on top of each other - GtkComboBox is not displayed correctly
Hi All, I've a modal window and on its top another modal window is opened. ( I know some may think of this as why but my use case requires that I open another modal window on the top of a modal window). There is a GtkComboBox in the topmost modal window and when I click on it to get the contents of drop down, the drop down doesnt come. The combo box will be in depressed state and when I click on it again it becomes normal. This is not observed in combo box which are on top of non modal windows. How can this be solved? Regards, Harinandan S ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Glade 3 and GtkCombobox
Hi All, I am using Glade3 and use GtkBuilder to create widgets. While using GtkCombobox, when I call gtk_combo_box_append_text, the application crashes. Is the combobox created not created using gtk_combobox_new_text? I need only text options. How to append text items? Regards, Harinandan S ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
RE: GtkComboBox problem
> -Original Message- > From: Diego Jacobi > Sent: Thursday, November 06, 2008 6:21 PM > > > Allways thought as a normal behaviour. > > > > If it is annoying it is a bug. :P The fact that the blank space vanishes and it displays as one would expect after scrolling down and back up would indicate that it's not doing it deliberately, i.e. a bug. > From: me > > I've just noticed another problem after upgrading to GTK 2.14.4. > It doesn't happen with GTK 2.12.12. That was not accurate. In fact it does happen with GTK 2.12.12 / Glib 2.16.6 in my Fedora 9 Linux system, but not with GTK 2.12.3 / Glib 2.14.4 which is the previous installation that I have on Windows. Ian ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Fwd: GtkComboBox problem
I had the same problem on ubuntu, but i dont have it now on debian lenny. 2008/11/6 Carlos Pereira <[EMAIL PROTECTED]>: > I use ubuntu 7.10 (dont know gnome version, sorry), and allways see this > behavior, when I use "brasero". > > http://www.carlao2006.xpg.com.br/imagens/brasero.png Also your image shows a bug on my brasero version. Brasero 0.8.0 shows incorrect speed numbers: 1x, 3x, 7x, 11x, 13x, 15x, The correct ones, minus one. :( > > Allways thought as a normal behaviour. > If it is annoying it is a bug. :P Cheers. Diego ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox problem
I use ubuntu 7.10 (dont know gnome version, sorry), and allways see this behavior, when I use "brasero". http://www.carlao2006.xpg.com.br/imagens/brasero.png Allways thought as a normal behaviour. Best regards, Carlos On Thu, Nov 6, 2008 at 9:15 PM, Ian Puleston <[EMAIL PROTECTED]>wrote: > Hi again, > > I've just noticed another problem after upgrading to GTK 2.14.4. This one > is > with GtkComboBox and happens on both Windows and Linux. It doesn't happen > with GTK 2.12.12. > > I have a combo box to which I add about 150 entries, and I see that the > look > of the combo box has changed between these releases. With GTK 2.12.12 when > the list opened it would extend from its location in the app up to the top > of the screen, and would have a traditional scroll bar on its right side. > With GTK 2.12.14 it extends all the way from to top bottom of the screen > and > has separate scroll-up and scroll-down arrows at top and bottom. > > The problem is that when it first opens, entries are only populated in the > bottom half of the visible list area, from the position of the control in > the app down. The top half from there to the top of the screen is empty - a > big blank area. If I scroll down the entries scroll up into that area, and > once I've scroll far enough for them to reach the top, then it is OK and > the > blank area is gone (if I scroll back up it does not reappear). > > I've uploaded a screenshot of it doing this here: > http://slracing.org/files/ComboBoxBug.jpg > > Anyone know if this is this a known problem? > > Ian > > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > -- = Carlos José de Almeida Pereira Ilhéus - Bahia - Brasil BLOG: http://starfightercarlao.blogspot.com http://starfightercarlaoenglish.blogspot.com (english version) "Que o caminho seja brando aos teus pés; Que o vento sopre leve em teus ombros; Que o Sol brilhe cálido em tuas faces; Que as chuvas caiam serenas em teus campos. E, até que eu de novo te veja, que a Deusa te guarde na palma da mão! " (Bênção Irlandesa adaptada) ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox problem
Hi again, I've just noticed another problem after upgrading to GTK 2.14.4. This one is with GtkComboBox and happens on both Windows and Linux. It doesn't happen with GTK 2.12.12. I have a combo box to which I add about 150 entries, and I see that the look of the combo box has changed between these releases. With GTK 2.12.12 when the list opened it would extend from its location in the app up to the top of the screen, and would have a traditional scroll bar on its right side. With GTK 2.12.14 it extends all the way from to top bottom of the screen and has separate scroll-up and scroll-down arrows at top and bottom. The problem is that when it first opens, entries are only populated in the bottom half of the visible list area, from the position of the control in the app down. The top half from there to the top of the screen is empty - a big blank area. If I scroll down the entries scroll up into that area, and once I've scroll far enough for them to reach the top, then it is OK and the blank area is gone (if I scroll back up it does not reappear). I've uploaded a screenshot of it doing this here: http://slracing.org/files/ComboBoxBug.jpg Anyone know if this is this a known problem? Ian ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkCombobox
Thanks to all. Regards, Harinandan S On Thu, Apr 10, 2008 at 10:25 PM, Milosz Derezynski <[EMAIL PROTECTED]> wrote: > gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtk_combo_box_get_model(combo)), > NULL); > > is better, since it uses public API > > 2008/4/10, Alexander Semenov <[EMAIL PROTECTED]>: > > > Hi. You can do something like this. > > > > #include > > > > int > > main (int argc, char *argv[]) > > { > > GtkWidget *window, *combo; > > GtkTreeModel *model; > > > > gtk_init (&argc, &argv); > > > > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > > combo = gtk_combo_box_new_text (); > > gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "1"); > > gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "2"); > > gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "3"); > > gtk_container_add (GTK_CONTAINER (window), combo); > > > > model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); > > g_assert (model); > > g_print ("%d\n", GTK_LIST_STORE (model)->length); > > > > gtk_widget_show_all (window); > > gtk_main (); > > return 0; > > > > } > > > > On Thu, 2008-04-10 at 18:13 +0530, Harinandan S wrote: > > > > > > Hi All, > > > > > > How can I find the number of entries I have in GtkCombobox during > > > runtime? I use gtk_combo_box_append_text for appending strings into > > > the combo box list. > > > > > > I'm using GTK+ 2.12.2 > > > -- > > > Regards, > > > Harinandan S > > > > > ___ > > > gtk-list mailing list > > > gtk-list@gnome.org > > > http://mail.gnome.org/mailman/listinfo/gtk-list > > > > ___ > > gtk-list mailing list > > gtk-list@gnome.org > > http://mail.gnome.org/mailman/listinfo/gtk-list > > > > -- ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkCombobox
gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtk_combo_box_get_model(combo)), NULL); is better, since it uses public API 2008/4/10, Alexander Semenov <[EMAIL PROTECTED]>: > > Hi. You can do something like this. > > #include > > int > main (int argc, char *argv[]) > { > GtkWidget *window, *combo; > GtkTreeModel *model; > > gtk_init (&argc, &argv); > > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > combo = gtk_combo_box_new_text (); > gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "1"); > gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "2"); > gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "3"); > gtk_container_add (GTK_CONTAINER (window), combo); > > model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); > g_assert (model); > g_print ("%d\n", GTK_LIST_STORE (model)->length); > > gtk_widget_show_all (window); > gtk_main (); > return 0; > > } > > On Thu, 2008-04-10 at 18:13 +0530, Harinandan S wrote: > > > > Hi All, > > > > How can I find the number of entries I have in GtkCombobox during > > runtime? I use gtk_combo_box_append_text for appending strings into > > the combo box list. > > > > I'm using GTK+ 2.12.2 > > -- > > Regards, > > Harinandan S > > > ___ > > gtk-list mailing list > > gtk-list@gnome.org > > http://mail.gnome.org/mailman/listinfo/gtk-list > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkCombobox
Hi. You can do something like this. #include int main (int argc, char *argv[]) { GtkWidget *window, *combo; GtkTreeModel *model; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); combo = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "1"); gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "2"); gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "3"); gtk_container_add (GTK_CONTAINER (window), combo); model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); g_assert (model); g_print ("%d\n", GTK_LIST_STORE (model)->length); gtk_widget_show_all (window); gtk_main (); return 0; } On Thu, 2008-04-10 at 18:13 +0530, Harinandan S wrote: > > Hi All, > > How can I find the number of entries I have in GtkCombobox during > runtime? I use gtk_combo_box_append_text for appending strings into > the combo box list. > > I'm using GTK+ 2.12.2 > -- > Regards, > Harinandan S > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkCombobox
Hi All, How can I find the number of entries I have in GtkCombobox during runtime? I use gtk_combo_box_append_text for appending strings into the combo box list. I'm using GTK+ 2.12.2 -- Regards, Harinandan S ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
gtkComboBox problem
I'm utilizing a combo_box in my application and am experiencing... difficulties with it... 1. When opened, the box extends to the top and bottom of my screen (I assume due to the amount of items contained within it) 2. Since the selected item is positioned at the same place on the y-axis as the box itself, when opened there is just gray, blank space in the box where no items exist. Any ideas on what I can do to solve this? there is no model connected to this box, by the way. Any help is appreciated. Thanks! C.Werner ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox Question
Hi, I create a new GtkComboBox with gtk_combo_box_with_new_model. In the model I put a pixbuf in a GtkListStore. In the GtkComboBox there is a GtkToggledButton, my question is: Can I remove the toggle button or modify its size? Maybe in the gtk resource file? I want a combobox without the button which will take an area and the width of the combobox will be the same with my pixbuf. Any suggestions or help will be appreciated. Yanan ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Set Allignment of GtkComboBox Columns
Hi, I compiled the gtkcombogrid, but my problem is still existing as there is no way avaibale to remove this situation. Infact in gtkcombogrid there is fixed column size which makes a separate list view. I made the combox itself list view where i placed the different columns. Due to dynamically changes comes in combobox columns modify its size and looks not alligned. So i want to modify the size of all columns run time due to effects of larger columns. BR, Ahmed richard boaz <[EMAIL PROTECTED]> wrote: Haven't tried this particular case myself, but it might be worth investigating using gtk_size_group_* routines. Perhaps this can be used to force the columns to be equally sized. richard On 7/19/07, Andrea Zagli <[EMAIL PROTECTED]> wrote: Il giorno ven, 06/07/2007 alle 06.05 -0700, ibrar ahmed ha scritto: > I created combo box with multiple columns, like in first column there > is pixbuf and string and other columns have only data string. But > problem is that columns of combobox are not well alligned. If some > entry have maximum string with pixpuf, columns of combobox are not > alligned so far. > I want to be arranged all columns of combobox. i don't know how you can do it with gtkcombobox, but you can try to use http://sourceforge.net/projects/gtkcombogrid ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list - Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Set Allignment of GtkComboBox Columns
Haven't tried this particular case myself, but it might be worth investigating using gtk_size_group_* routines. Perhaps this can be used to force the columns to be equally sized. richard On 7/19/07, Andrea Zagli <[EMAIL PROTECTED]> wrote: Il giorno ven, 06/07/2007 alle 06.05 -0700, ibrar ahmed ha scritto: > I created combo box with multiple columns, like in first column there > is pixbuf and string and other columns have only data string. But > problem is that columns of combobox are not well alligned. If some > entry have maximum string with pixpuf, columns of combobox are not > alligned so far. > I want to be arranged all columns of combobox. i don't know how you can do it with gtkcombobox, but you can try to use http://sourceforge.net/projects/gtkcombogrid ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Set Allignment of GtkComboBox Columns
Il giorno ven, 06/07/2007 alle 06.05 -0700, ibrar ahmed ha scritto: > I created combo box with multiple columns, like in first column there > is pixbuf and string and other columns have only data string. But > problem is that columns of combobox are not well alligned. If some > entry have maximum string with pixpuf, columns of combobox are not > alligned so far. > I want to be arranged all columns of combobox. i don't know how you can do it with gtkcombobox, but you can try to use http://sourceforge.net/projects/gtkcombogrid signature.asc Description: Questa è una parte del messaggio firmata digitalmente ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Set Allignment of GtkComboBox Columns
Hi, I created combo box with multiple columns, like in first column there is pixbuf and string and other columns have only data string. But problem is that columns of combobox are not well alligned. If some entry have maximum string with pixpuf, columns of combobox are not alligned so far. I want to be arranged all columns of combobox. how i can be? BR, Ibrar Ahmed - Pinpoint customers who are looking for what you sell. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox style property appears-as-list
Il giorno dom, 15/10/2006 alle 10.45 +0330, Mohsen Saboorian ha scritto: > 1. Why the property "appears-as-list" of GtkComboBox is read only? A > user may want to have a scroll bar near a large list. I've noticed > that PyGTK has this property changeable: > http://www.pygtk.org/docs/pygtk/class-gtkcombobox.html try GtkComboGrid http://sourceforge.net/projects/gtkcombogrid signature.asc Description: Questa è una parte del messaggio firmata digitalmente ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox style property appears-as-list
Hi, 1. Why the property "appears-as-list" of GtkComboBox is read only? A user may want to have a scroll bar near a large list. I've noticed that PyGTK has this property changeable: http://www.pygtk.org/docs/pygtk/class-gtkcombobox.html 2. Is it possible to set the visible number of items (GtkComboBoxEntry) in a combo box? Thanks. -- View this message in context: http://www.nabble.com/GtkComboBox-style-property-appears-as-list-tf2438000.html#a6798441 Sent from the Gtk+ - General mailing list archive at Nabble.com. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox style property appears-as-list
Hi, 1. Why the property "appears-as-list" of GtkComboBox is read only? A user may want to have a scroll bar near a large list. I've noticed that PyGTK has this property changeable: http://www.pygtk.org/docs/pygtk/class-gtkcombobox.html 2. Is it possible to set the visible number of items (GtkComboBoxEntry) in a combo box? Thanks. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox - button press event
Solution at this moment: Don't use GtkComboBox, Use GtkMenuToolButton instead. Best wishes, --Hans ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox - button press event
Hans Oesterholt-Dijkema wrote: Tristan Van Berkom schreef: Maybe you can achive a "one shot selection" kind of functionality if you make sure to clear the selection after using it every time ? (so the selection "always changes") I have considered this, but it doesn't make me happy. I'm using this specific combobox as a style selector for a styled editor (on top of gtktextbuffer/view). With each cursor movement, the style changes too. I'd need two widgets to achieve the wanted result. Don't like that at all. Well, you can always use your own treeview... Cheers, -Tristan ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox - button press event
Tristan Van Berkom schreef: Maybe you can achive a "one shot selection" kind of functionality if you make sure to clear the selection after using it every time ? (so the selection "always changes") I have considered this, but it doesn't make me happy. I'm using this specific combobox as a style selector for a styled editor (on top of gtktextbuffer/view). With each cursor movement, the style changes too. I'd need two widgets to achieve the wanted result. Don't like that at all. Thanks, --Hans ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox - button press event
Hans Oesterholt-Dijkema wrote: L.S., I want to listen to the 'button-press-event' on a GtkComboBox, but it doesn't work. What I actually want to achieve, is to be able to know if a user 'chooses' an entry (either the same or an other). The 'changed' signal isn't sent on such occasions. Unfortunatly, this is close to impossible (if not impossible). The gtkcombobox code creates a popup window to display the treeview, and that is all on a private struct declared in the C source (not header)... so I see no way of getting to that widget :( Maybe you can achive a "one shot selection" kind of functionality if you make sure to clear the selection after using it every time ? (so the selection "always changes") Cheers, -Tristan ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox - button press event
L.S., I want to listen to the 'button-press-event' on a GtkComboBox, but it doesn't work. What I actually want to achieve, is to be able to know if a user 'chooses' an entry (either the same or an other). The 'changed' signal isn't sent on such occasions. Best regards, --Hans ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Le samedi 14 janvier 2006 à 09:58 +0100, Andrea Zagli a écrit : > is there a way to replace gtkcombobox dropdown menu with a gtktreeview? Use gtk_combo_box_new_with_model with a GtkTreeStore* argument. Best regards, Jean Bréfort ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox
is there a way to replace gtkcombobox dropdown menu with a gtktreeview? ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
In edit mode of GtkTreeView the data can not be retrieved from GtkComboBox
Hi, When some row of GtkTreeView is in edit mode and when the cursor is in GtkComboBox the selected data of this cell can not be retrieved. I try the same situation with another types of components like Edit, Text, CheckBox, etc. where everything is working. The problem is occured only when the cursor is at ComboBox in edit mode. The problem can be inderectly solved when I move the selected cell to another cell of the same row with mouse or keyboard. Any ideas how to solve this problem? -- Best Regards, Miroslav Nachev ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox can't be reset
Diego Zuccato wrote: > I Noticed an anti-intuitive thing. > Once I've selected a value in a combo box, I can't "reset" it (from an > user's POV). Is there a reason not to handle an "esc" press on it to > call ...set_active(this, -1) ? I know I can do it myself in my programs, > but IMVHO it should be done by the library. Why would you want to "reset" a combo box from the user interface? Even if one ignores the fact that such a change would (possibly) break quite a lot of applications, it doesn't seem to be very useful at all. If an application offers a "reset"-state to the user, it'll usually include a "None"/"Disabled" item in the combobox' model. > BYtE, > Diego. Benedikt ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox can't be reset
Diego Zuccato wrote: >>> I Noticed an anti-intuitive thing. >>> Once I've selected a value in a combo box, I can't "reset" it (from an >>> user's POV). Is there a reason not to handle an "esc" press on it to >>> call ...set_active(this, -1) ? I know I can do it myself in my programs, >>> but IMVHO it should be done by the library. >> >> Why would you want to "reset" a combo box from the user interface? Even >> if one ignores the fact that such a change would (possibly) break quite >> a lot of applications, it doesn't seem to be very useful at all. If an >> application offers a "reset"-state to the user, it'll usually include a >> "None"/"Disabled" item in the combobox' model. > > Then Gtk should ENFORCE that by selecting the first row of the model. > I'm using a model filled from a DB and it's quite useful to have the > current behaviour PLUS "esc" management. And it's orthogonal (think a > box that lets you select an user from a list, or "nothing" to broadcast: > now, once you've selected a user you can't rethink and send to all). IMO > the current behaviour is the safest (a row in the model gets accessed > only when the user wants to), and adding "esc" handling shouldn't break > anything. A complete solution would require API changes > (gtk_combo_box_set_default_selection() ?) to be done really well, but > calling gtk_combo_box_set_active(this, -1) should be quite safe. Then it'd be better to add an item "Broadcast to all users". How many users of your application would assume that selecting "nothing" means "broadcast to all users" anyway? Automatically selecting the first item of the model once the model is set sounds like a sane option (esp. since that's what nearly every application does right now, as an "empty combobox" is more or less confusing to the casual user). > BYtE, > Diego. Benedikt ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox can't be reset
Benedikt Meurer wrote: I Noticed an anti-intuitive thing. Once I've selected a value in a combo box, I can't "reset" it (from an user's POV). Is there a reason not to handle an "esc" press on it to call ...set_active(this, -1) ? I know I can do it myself in my programs, but IMVHO it should be done by the library. Why would you want to "reset" a combo box from the user interface? Even if one ignores the fact that such a change would (possibly) break quite a lot of applications, it doesn't seem to be very useful at all. If an application offers a "reset"-state to the user, it'll usually include a "None"/"Disabled" item in the combobox' model. Then Gtk should ENFORCE that by selecting the first row of the model. I'm using a model filled from a DB and it's quite useful to have the current behaviour PLUS "esc" management. And it's orthogonal (think a box that lets you select an user from a list, or "nothing" to broadcast: now, once you've selected a user you can't rethink and send to all). IMO the current behaviour is the safest (a row in the model gets accessed only when the user wants to), and adding "esc" handling shouldn't break anything. A complete solution would require API changes (gtk_combo_box_set_default_selection() ?) to be done really well, but calling gtk_combo_box_set_active(this, -1) should be quite safe. BYtE, Diego. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox can't be reset
2005/11/28, ibrar ahmed <[EMAIL PROTECTED]>: > hello All, > There is any way to show a wizard type interface using gtk. > If hav't found any idea and widget in documentation. So if any body > knows the details information about it then tell me how to create the > wizard type interface in gtk. Ahmed I think you should NOT reply to a topic talking about something completely different but open a new thread insted, in the meantime have a look at gnome druid: http://developer.gnome.org/doc/API/2.0/libgnomeui/GnomeDruid.html cheers -- Gian Mario Tagliaretti PyGTK GUI programming http://www.parafernalia.org/pygtk/ ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox can't be reset
2005/11/28, Diego Zuccato <[EMAIL PROTECTED]>: > Hello. > > I Noticed an anti-intuitive thing. > Once I've selected a value in a combo box, I can't "reset" it (from an > user's POV). Is there a reason not to handle an "esc" press on it to > call ...set_active(this, -1) ? I know I can do it myself in my programs, > but IMVHO it should be done by the library. > > The patch is trivial, I could send it... Diego, I think you should open a new bug in bugzilla and send a patch against CVS. ciao -- Gian Mario Tagliaretti PyGTK GUI programming http://www.parafernalia.org/pygtk/ ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox can't be reset
hello All, There is any way to show a wizard type interface using gtk. If hav't found any idea and widget in documentation. So if any body knows the details information about it then tell me how to create the wizard type interface in gtk. Rgards, Ibrar Ahmed On 11/28/05, Diego Zuccato <[EMAIL PROTECTED]> wrote: > Hello. > > I Noticed an anti-intuitive thing. > Once I've selected a value in a combo box, I can't "reset" it (from an > user's POV). Is there a reason not to handle an "esc" press on it to > call ...set_active(this, -1) ? I know I can do it myself in my programs, > but IMVHO it should be done by the library. > > The patch is trivial, I could send it... > > BYtE, > Diego. > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox can't be reset
Hello. I Noticed an anti-intuitive thing. Once I've selected a value in a combo box, I can't "reset" it (from an user's POV). Is there a reason not to handle an "esc" press on it to call ...set_active(this, -1) ? I know I can do it myself in my programs, but IMVHO it should be done by the library. The patch is trivial, I could send it... BYtE, Diego. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox focus issue
Hi, I am trying to grab focus to GtkComboBox but focus is not set to it. Here's a sample program. What's wrong with the code? gboolean kp(GtkWidget *w, GdkEvent* e, gpointer d) { printf("Key Pressed\n"); gtk_widget_grab_focus(GTK_WIDGET(d)); return TRUE; } int main( int argc, char *argv[] ) { gtk_init (&argc, &argv); GtkWidget *dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* l = gtk_layout_new(NULL,NULL); gtk_widget_show(l); GtkWidget* b = gtk_button_new_from_stock(GTK_STOCK_FLOPPY); gtk_layout_put(GTK_LAYOUT(l),b,40,70); ts = gtk_tree_store_new(1, G_TYPE_STRING); GtkCellRenderer* cr = gtk_cell_renderer_text_new(); GtkTreeIter iter; gtk_tree_store_insert(ts, &iter, NULL, 0); gtk_tree_store_set(ts, &iter, 0, "FIRST", -1); combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts)); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),cr,FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),cr,"text",0,NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0); gtk_widget_show(combo); gtk_layout_put(GTK_LAYOUT(l),combo,20,20); gtk_widget_grab_focus(b); gtk_widget_show(b); g_signal_connect(b,"key-press-event",G_CALLBACK(kp),combo); gtk_container_add(GTK_CONTAINER(dialog),l); gtk_widget_show(dialog); gtk_main(); return 0; } Thanks ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
On Fri, 2005-07-01 at 20:11 +0530, Viraj Chatterjee wrote: > Is there any option of getting this done in GTK+ 2.4.14? > No, insensitive items in combo boxes are a 2.6 feature. Matthias ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Is there any option of getting this done in GTK+ 2.4.14? -vc - Original Message - From: "Matthias Clasen" <[EMAIL PROTECTED]> To: "Pramod Patangay" <[EMAIL PROTECTED]> Cc: Sent: Friday, July 01, 2005 8:15 PM Subject: Re: GtkComboBox On Fri, 2005-07-01 at 17:06 +0530, Pramod Patangay wrote: Hi, I asked this question previously but there were no replies. So here I am again. I would like to disable a particular entry in the GtkComboBox. I am using a GtkComboBox with a model and supplying it cell renderers. If disabling a particular entry is not possible, can I at least change the look of that entry like background or foreground so that the user knows that it is disabled. How can I do that? I see some functions like gtk_cell_renderer_render, what does this do? In the latest stable gtk release, gtk-demo has an example showing how to do this. Matthias ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
On Fri, 2005-07-01 at 17:06 +0530, Pramod Patangay wrote: > Hi, > > I asked this question previously but there were no replies. So here I > am again. I would like to disable a particular entry in the > GtkComboBox. I am using a GtkComboBox with a model and supplying it > cell renderers. If disabling a particular entry is not possible, can I > at least change the look of that entry like background or foreground > so that the user knows that it is disabled. How can I do that? I see > some functions like gtk_cell_renderer_render, what does this do? > In the latest stable gtk release, gtk-demo has an example showing how to do this. Matthias ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
On Fri, Jul 01, 2005 at 05:06:15PM +0530, Pramod Patangay wrote: > I asked this question previously but there were no replies. So here I > am again. I would like to disable a particular entry in the > GtkComboBox. I am using a GtkComboBox with a model and supplying it > cell renderers. So just add a column that will control sensitivity. Yeti -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? === #include enum { COL_TEXT, COL_SENS }; int main(int argc, char *argv[]) { GtkCellRenderer *renderer; GtkListStore *store; GtkTreeIter iter; GtkWidget *window, *combo; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COL_TEXT, "Foo", COL_SENS, TRUE, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COL_TEXT, "Bar", COL_SENS, TRUE, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COL_TEXT, "Baz", COL_SENS, FALSE, -1); combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer, "text", COL_TEXT); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer, "sensitive", COL_SENS); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); gtk_container_add(GTK_CONTAINER(window), combo); gtk_widget_show_all(window); gtk_main(); return 0; } ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox
Hi, I asked this question previously but there were no replies. So here I am again. I would like to disable a particular entry in the GtkComboBox. I am using a GtkComboBox with a model and supplying it cell renderers. If disabling a particular entry is not possible, can I at least change the look of that entry like background or foreground so that the user knows that it is disabled. How can I do that? I see some functions like gtk_cell_renderer_render, what does this do? Thanks ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox again
Hi, Is there any way to add a separator in the GtkComboBox. I am using combo box with a tree model. Also I need to add markup properties that applies to a whole column. How do I do that? I tried the following code, but it doesn't work. ts = gtk_tree_store_new(1,G_TYPE_STRING); GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts)); GtkCellRenderer* cr = gtk_cell_renderer_text_new(); //g_object_set(G_OBJECT(cr),"weight",1000,NULL); //this works g_object_set(G_OBJECT(cr),"markup","some text",NULL); GtkTreeIter iter; gtk_tree_store_insert(ts, &iter, NULL, 0); gtk_tree_store_set(ts, &iter, 0, "FIRST",-1); GtkWidget* combo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(ts),0); gtk_cell_layout ... One more problem that I had was with disabling of a particular entry in the combo box which doesn't seem so easy. All these things were accomplished quite easily with GtkOptionMenu which is now deprecated in preference to GtkComboBox. But GtkComboBox doesn't seem to have any easy ways to achieve the same. Why were things designed like this? or am I missing something here? Can anyone point to some detailed documentation on the net related to GtkComboBox or migrating from GtkOptionMenu to GtkComboBox? Thanks -Pramod ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Hi Michael, If I am not wrong, with tree model we can even display images and text together as part of the menu items. This is the reason why I chose to use tree model. If there was only text then you are correct. Thanks to Neumann for pointing out what I was missing in the code. -Pramod On 5/31/05, Michael Ott <[EMAIL PROTECTED]> wrote: > Hello Pramod! > > > I was trying out GtkComboBox. I have Gtk-2.4. I have created a > > GtkTreeModel and populated the corresponding GtkTreeStore. But when I > > run the program, the entries are not shown. Why is this happening? I > > am attaching the program here: > > > > GtkTreeStore *ts = gtk_tree_store_new(1,G_TYPE_STRING); > > GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts)); > > GtkCellRenderer* cr = gtk_cell_renderer_text_new(); > > GtkTreeViewColumn* tvc = > > gtk_tree_view_column_new_with_attributes(NULL, cr, "text", 0, NULL); > > gtk_tree_view_append_column (GTK_TREE_VIEW(tv), tvc); > > gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE); > > GtkTreeSelection* TS = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); > > gtk_tree_selection_set_mode(TS, GTK_SELECTION_BROWSE); > > > > GtkTreeIter iter; > > > > gtk_tree_store_insert(ts, &iter, NULL, 0); > > gtk_tree_store_set(ts, &iter, 0, "FIRST",-1); > > > > gtk_tree_store_insert(ts, &iter, NULL, 0); > > gtk_tree_store_set(ts, &iter, 0,"SECOND",-1); > > > > GtkWidget* combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts)); > > gtk_container_add(GTK_CONTAINER(dialog),combo); > > gtk_widget_show(combo); > > > > Can anyone please point out, why the entries are now show n in the combo > > box? > Why so difficult. You can use gtk_combo_box_append_text and need no tree > model > > CU > > Michael > > -- >Michael Ott, e-mail: [EMAIL PROTECTED], www.zolnott.de > I am registered as user #275453 with the Linux Counter, http://counter.li.org. > > > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Hello Pramod! > I was trying out GtkComboBox. I have Gtk-2.4. I have created a > GtkTreeModel and populated the corresponding GtkTreeStore. But when I > run the program, the entries are not shown. Why is this happening? I > am attaching the program here: > > GtkTreeStore *ts = gtk_tree_store_new(1,G_TYPE_STRING); > GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts)); > GtkCellRenderer* cr = gtk_cell_renderer_text_new(); > GtkTreeViewColumn* tvc = > gtk_tree_view_column_new_with_attributes(NULL, cr, "text", 0, NULL); > gtk_tree_view_append_column (GTK_TREE_VIEW(tv), tvc); > gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE); > GtkTreeSelection* TS = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); > gtk_tree_selection_set_mode(TS, GTK_SELECTION_BROWSE); > > GtkTreeIter iter; > > gtk_tree_store_insert(ts, &iter, NULL, 0); > gtk_tree_store_set(ts, &iter, 0, "FIRST",-1); > > gtk_tree_store_insert(ts, &iter, NULL, 0); > gtk_tree_store_set(ts, &iter, 0,"SECOND",-1); > > GtkWidget* combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts)); > gtk_container_add(GTK_CONTAINER(dialog),combo); > gtk_widget_show(combo); > > Can anyone please point out, why the entries are now show n in the combo box? Why so difficult. You can use gtk_combo_box_append_text and need no tree model CU Michael -- Michael Ott, e-mail: [EMAIL PROTECTED], www.zolnott.de I am registered as user #275453 with the Linux Counter, http://counter.li.org. pgpY5fPs6dhwV.pgp Description: PGP signature ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkComboBox
Hi, Pramod Patangay <[EMAIL PROTECTED]> writes: > I was trying out GtkComboBox. I have Gtk-2.4. I have created a > GtkTreeModel and populated the corresponding GtkTreeStore. But when I > run the program, the entries are not shown. Why is this happening? I > am attaching the program here: > > GtkTreeStore *ts = gtk_tree_store_new(1,G_TYPE_STRING); > GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts)); > GtkCellRenderer* cr = gtk_cell_renderer_text_new(); > GtkTreeViewColumn* tvc = > gtk_tree_view_column_new_with_attributes(NULL, cr, "text", 0, NULL); > gtk_tree_view_append_column (GTK_TREE_VIEW(tv), tvc); > gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE); > GtkTreeSelection* TS = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); > gtk_tree_selection_set_mode(TS, GTK_SELECTION_BROWSE); > > GtkTreeIter iter; > > gtk_tree_store_insert(ts, &iter, NULL, 0); > gtk_tree_store_set(ts, &iter, 0, "FIRST",-1); > > gtk_tree_store_insert(ts, &iter, NULL, 0); > gtk_tree_store_set(ts, &iter, 0,"SECOND",-1); > > GtkWidget* combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts)); > gtk_container_add(GTK_CONTAINER(dialog),combo); > gtk_widget_show(combo); > > Can anyone please point out, why the entries are now show n in the combo box? Your combobox only has a model. You need to add a cell-renderer to the combo-box. Sven ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
GtkComboBox
Hi, I was trying out GtkComboBox. I have Gtk-2.4. I have created a GtkTreeModel and populated the corresponding GtkTreeStore. But when I run the program, the entries are not shown. Why is this happening? I am attaching the program here: GtkTreeStore *ts = gtk_tree_store_new(1,G_TYPE_STRING); GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts)); GtkCellRenderer* cr = gtk_cell_renderer_text_new(); GtkTreeViewColumn* tvc = gtk_tree_view_column_new_with_attributes(NULL, cr, "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(tv), tvc); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE); GtkTreeSelection* TS = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); gtk_tree_selection_set_mode(TS, GTK_SELECTION_BROWSE); GtkTreeIter iter; gtk_tree_store_insert(ts, &iter, NULL, 0); gtk_tree_store_set(ts, &iter, 0, "FIRST",-1); gtk_tree_store_insert(ts, &iter, NULL, 0); gtk_tree_store_set(ts, &iter, 0,"SECOND",-1); GtkWidget* combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts)); gtk_container_add(GTK_CONTAINER(dialog),combo); gtk_widget_show(combo); Can anyone please point out, why the entries are now show n in the combo box? Thanks ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Setting tooltips on GtkComboBox
Is there a list of GTK_NO_WINDOW widgets? Or is there an easy way to tell from the GTK manual that a widget is GTK_NO_WINDOW? I'm sure this is the cause of my combobox event problems and I never thought that the combobox wouldn't have its own window. The other controls I've run into without windows have all made a lot of sense, frames, labels, etc. Labels because they need to be as lightweight as possible, Frames so they are "transparent", etc. However, it seems like the combo box, being one of the most complex controls in GTK, wouldn't incur much overhead if it had a window by default. On Mon, 2005-02-21 at 15:16, Egon Andersen wrote: > Problem solved! > Putting the GtkComboBox inside an GtkEventBox solved the problem. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list