[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: [gnome-db] I'm still alive and here
From:       "nshmyrev" <nshmyrev () yandex ! ru>
Date:       2005-03-21 15:37:52
Message-ID: 423EEA50.000002.01073 () camay ! yandex ! ru
[Download RAW message or body]

> Vivien Malerba wrote:
> 
> > On Sat, 19 Mar 2005 20:55:38 +1300, Dru <andru@treshna.com> wrote:
> > 
> > 
> > > Rodrigo Moya wrote:
> > > 
> > > 
> > > 
> > > > On Fri, 2005-03-18 at 12:32 +1300, Dru wrote:
> > > > 
> > > > 
> > > > 
> > > > 
> > [...]
> > 
> > 
> > > I'm currently working on updating my gtk support and removing
> > > everything thats depreciated from my projects.  Has anyone
> > > had experence with GtkComboBox? I'm finding it less friendly
> > > than the older GtkCombo code with lots of little issues.  Has
> > > anyone else used it in databases and know how to make
> > > combo boxes more user friendly to people who spend there
> > > entire day entering records.  I modify the listings a lot
> > > before display so i am not really interested in using something
> > > that binds directly to a database object.
> > > 
> > > 
> > 
> > Just for information, I wrote the GnomeDbCombo widget with the purpose
> > of displaying and remaining up to date with a GdaDataModel contents
> > (which can be modifed in any way you want). That widget does not by
> > itself allow modifications to the GdaDataModel, but that could be
> > added.
> > 
> > 
> I'm still trying to work though my ComboBox problems.
> 
> I've found a header for GtkDbCombo and going though it now.
> I dont know what it looks on the screen, any apps you can think
> of the top of your head that use it? I will give it a try it
> 
> Heres my current rant of GtkComboBox/GtkComboBoxEntry problems
> from a database user perspective. Sorry for whinning so much. 
> I dont like been beaten by a problem.  If GtkDbCombo doesnt some of these
> issues let me know.
> 
> GtkComboEntry issues are:
> * Does not do selection, you dont know what at all you have selected in 
> the list.
> The popup list does not scroll to currently selected cell.  This is 
> proberly
> the biggest thing that makes GtkComboEntry unuseable.
> * Takes 2 tab stops when it should be one. I can work around this with 
> signals.
> * Difficult to work with autocompletion to jump to record. (I tried using
> GtkEntryCompletion but very slow and segfaults on UTF-8). I think i will 
> try GCompletion next)
> * If you type a value into the GtkEntry that matchs a list item. it 
> doesnt recongise
> what you have selected in that list item.  This is a debatable if its a 
> good or bad
> thing and i can work around it.
> * Entry box should retain focus after selection not the list activiation 
> button.
> * UTF-8 causes a few problems with blank population under some situations.
> 
> GtkComboBox issues are:
> * Not keyboard input friendly, need to be able to start typing and it 
> jumps to the row in a ComboBox.
> (As you can do with other widgetsets like html). 
> * For larger lists (20 + items) it looks unfriendly with it taking up 
> all the veritical space.
> * Shows blank space fillers when near window edge.
> * The popup list covers up widgets above it. A person doing data entry may
> often have to check back to what they typed into a field previsouly but
> they can't see it because there pop up list covers what they type. (if 
> list pops up
> below it doesnt matter because they havn't filled in data below them yet)
> * If you have a number of GtkComboBox's on the form close together the 
> user very
> quickly confuses them and has no idea on what field they are actually 
> entering
> data into.
> 
> I should really only use GtkComboBox for very small fixed record sets of 
> less than 8
> items but because GtkComboBoxEntry issues I'm trying to use it in places 
> i shouldnt.
> 
> These items may seem minor, but if your doing a lot of data entry it is 
> quite
> critical.
> 
> Should I be writing my own widget using GtkEntry and GtkTreeView to 
> accomplish
> these things and works correctly? Try using GtkDbComboBox? Switch back 
> to GtkCombo? 
> Or try make GtkComboBox/ComboBoxEntry work correctly?
> 

Well, GtkComboBox has some issues, personally I don't like drop of GnomeEntry with \
some important features, like gconf session support directly in entry. But  those \
things are already in the past. Now we should just make GtkComboBox better :) \
Probably first step in this direction can be filling bugzilla bugs about all problems \
you've found.

First, you should note that ComboBoxEntry is nothing more than ComboBox with \
simplified interface. So there is no sence to talk about GtkComboBoxEntry and \
GtkComboBox as a different widgets. 

Some problems above are caused by GtkCombobox implementation with menus. You should \
know that two types of comboboxes are possible - implemenation with GtkMenu and with \
TreeView. Tree view implementation works much better since TreeView selection \
capabilites and scrolling capabilities are much more advanced when GtkMenu's one.

The attached patch fixes one of your problems - it scrolls to active cell when \
combobox popups GtkMenu , so current ComboBoxEntry will always visible. It would be \
nice if someone could review and commit it.

About current element selection - menu selection is a bit floating thing, it should \
always follow the cursor, so probably there should be implemented some prelight of \
active menu element, but this requires work.

So those kind of problems is solvable, just need some work. Filling bugs against gtk \
can help to start.


["menu-patch.diff" (menu-patch.diff)]

--- gtkmenu.c	2005-03-01 09:28:56.000000000 +0300
+++ gtkmenu.c.new	2005-03-21 18:15:50.000000000 +0300
@@ -3393,10 +3393,15 @@ static void
 gtk_menu_position (GtkMenu *menu)
 {
   GtkWidget *widget;
+  GtkWidget *active;
   GtkRequisition requisition;
   GtkMenuPrivate *private;
   gint x, y;
   gint scroll_offset;
+
+  gint active_top_offset;
+  gint active_bottom_offset;
+
   gint menu_height;
   gboolean push_in;
   GdkScreen *screen;
@@ -3588,17 +3593,67 @@ gtk_menu_position (GtkMenu *menu)
       private->x = x;
       private->y = y;
     }
+
+  /* Make sure that active element will be always onscreen */
+  active_top_offset = 0;
+  active_bottom_offset = 0;
+  active = gtk_menu_get_active (menu);
+  if (active)
+    {
+      GList *children;
+      GtkWidget *child;
+      GtkRequisition child_requisition;
+      
+      for (children = GTK_MENU_SHELL (menu)->children; children; children = children->next)
+	{
+          child = children->data;
+
+	  if (GTK_WIDGET_VISIBLE (child))
+	    {
+		  gtk_widget_get_child_requisition (child, &child_requisition);
+		  active_bottom_offset += child_requisition.height;
+	    }
+
+	  if (child == active)
+		break;
+
+	   active_top_offset = active_bottom_offset;
+        }
+   }
   
-  if (y + requisition.height > monitor.y + monitor.height)
-    requisition.height = (monitor.y + monitor.height) - y;
+  if (y + requisition.height > monitor.y + monitor.height) 
+   {
+
+     if (active_bottom_offset >= (monitor.y + monitor.height - y)) 
+       {
+  	  scroll_offset += active_bottom_offset - (monitor.y + monitor.height - y);
+	 
+	  if (active_bottom_offset < requisition.height)
+	       scroll_offset += MENU_SCROLL_ARROW_HEIGHT;  
+       }
+
+     requisition.height = (monitor.y + monitor.height) - y;
+   }
   
   if (y < monitor.y)
     {
-      scroll_offset += monitor.y - y;
+      if (active_top_offset < monitor.y - y) 
+        {
+	  scroll_offset += active_top_offset;
+	  
+	  if (active_top_offset > 0)
+	       scroll_offset += MENU_SCROLL_ARROW_HEIGHT;  
+	}
+      else
+        {
+	  scroll_offset += monitor.y - y;
+	}
+	
       requisition.height -= monitor.y - y;
       y = monitor.y;
     }
 
+
   if (scroll_offset > 0)
     scroll_offset += MENU_SCROLL_ARROW_HEIGHT;
   


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic