[gtk-list] Re: Possible to place widgets *on top* of CList?
- From: Pascal Rigaux <rigaux irisa fr>
- To: gtk-list redhat com
- Subject: [gtk-list] Re: Possible to place widgets *on top* of CList?
- Date: Thu, 7 May 1998 15:06:36 +0200
I had the same problem with editing a entry in a GtkCList.
I've tried adding a GtkEntry on top of the GtkCList at the right place.
Here are the problems I've faced:
- the entry was too large (it was on the scrollbar). In fact as I was putting
all this in a vbox, my width was taken a minimum, and the entry was allocated
more wide than necessary. A solution was to put the entry in a hbox.
- if you scroll with the scrollbar, the entry doesn't move. To handle this, I
added a signal handler for "button-press" for the whole window. It tests if the
event is inside the entry. Otherwise it destroys the entry, acting like a
cancel.
- if you resize the window, same problem. The workaround I've found is another
signal handler for "allocate" which destroys the entry.
- the vbox allocates some room at the bottom of the window, as I use
gtk_pack_start. For that point, I must be missing an easy solution. The only
workaround I've found is using a padding of half the height of my entry:
gtk_pack_start(-, -, FALSE, FALSE, -height/2).
- as I've added shortcuts to scroll the CList (as well as shift-arrows and so
on), the focus mustn't leave the entry widget. I start giving the focus (with
gtk_widget_grab_focus) to the entry and unset the CAN_FOCUS flag of the
clist. When destroying the entry, I restore the CAN_FOCUS flag, and give back
the focus to the clist.
If someone wants my (disastrous, horrible...) code, I can give it...
Any comments ?
Hope it helps, Pixel.
Rob Browning writes:
> For those that don't recall, I'm working on a register window for
> GnuCash where when you click on a CList cell, an entry widget should
> pop up under the cursor, and move to a new cell whenever you click
> somewhere else.
>
> I have two main problems (any help greatly appreciated):
>
> 2) The combobox code I followed doesn't have any handling for
> scrolling or moving windows. This doesn't matter for coboboxes
> because you can't move a window or do anything else while a combo list
> is popped up, and clicking anywhere else takes the list down. In the
> code I'm working on, it's a big problem. It's quite strange looking
> to drag the register and leave the editing cell sitting by itself on
> the X desktop. Also, scrolling the CList leaves the editing widget
> behind.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]