Re: [gtk-list] Re: Clists (Feature request)
- From: Anders Melchiorsen <and kampsax dtu dk>
- To: gtk-list redhat com
- Cc: fvw var cx
- Subject: Re: [gtk-list] Re: Clists (Feature request)
- Date: 11 Feb 2000 01:49:31 +0100
Frank v Waveren <fvw@var.cx> wrote:
> I couldn't find the program on your page... Could you send me the
> program (would be usefull, as I said, I have no gtk experience), or
> could somebody tell me how to make the
> on_person_selector_list_key_press_event function the handler for
> keypresses? Thanks
gtk_signal_connect(GTK_OBJECT (clistwidget), "key_press_event",
GTK_SIGNAL_FUNC (on_person_selector_list_key_press_event),
0);
But the method Rene suggested for setting focus (changing
clist->focus_row) will not work in browse mode of the clist. There are
two kinds of focus (marked either by a solid block or by a thin frame)
and changing ->focus_row only changes one of them. I therefore use the
following function which is clumsy, but works. I would like to know if
someone knows of a better way to do this through the public interface.
void GUIBrowse::FocusRow(int position)
{
int oldposition = recipients->focus_row;
if (position == oldposition)
return;
gtk_signal_emit_by_name(GTK_OBJECT(recipients), "scroll_vertical",
GTK_SCROLL_JUMP,
(gfloat)position/(recipients->rows-1));
// Rounding errors might have positioned us slightly wrong :-/.
oldposition = recipients->focus_row;
if (position < oldposition)
for (int i = oldposition; i != position; --i)
gtk_signal_emit_by_name(GTK_OBJECT(recipients),
"scroll_vertical",
GTK_SCROLL_STEP_BACKWARD, 0);
else if (position > oldposition)
for (int i = oldposition; i != position; ++i)
gtk_signal_emit_by_name(GTK_OBJECT(recipients),
"scroll_vertical",
GTK_SCROLL_STEP_FORWARD, 0);
}
I think the correction of the position could be reduced to half of the
if and without the for loop, but I prefer to play it safe since I am
not sure about the way it is supposed to work.
Good luck,
Anders.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]