Simple(?) gtk_clist_moveto problem.
- From: Karol Bryd <kbryd femina com pl>
- To: Gtk-list redhat com
- Subject: Simple(?) gtk_clist_moveto problem.
- Date: Fri, 14 May 1999 12:02:34 +0200
Czesc! (Hi!)
I've just started my gtk programming and I have one simple
question:
how should I use gtk_clist_move()? I have read tutorial twice but
I still don't know why it doesn't work. I have included a small c
source
that tries to display a window, with a clist in it, and a button.
My intention is to change current clist entry when user clicks on
the button. The current entry should be then centered in the clist
and it's background color should be blue. Can somebody tell me
what is wrong with this program? I'd be very grateful. Thanks.
PS. sorry for my English - it's awfull - I know :-)
Pozdrowienia (Regards)
--
Karol Bryd //
http://www.kki.net.pl/~kbryd \ // Team *AMIGA*
kbryd@femina.com.pl \X/ Powered by Linux
The right to be let alone is indeed the beginning of all freedom.
-- Justice Douglas
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
GtkWidget *gtklist;
void *funct(void *args)
{
static gint row = 0;
printf("visibility of row %d: %s\n", row, (gtk_clist_row_is_visible(GTK_CLIST(gtklist), row)==GTK_VISIBILITY_NONE)?"none":"full" );
gtk_clist_moveto(GTK_CLIST(gtklist), 0, row, 0.5, 0.5);
row += 1;
}
gint main (int argc, gchar *argv[])
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *scrolled_window;
GtkWidget *frame, *button;
GtkWidget *list_item;
guint i;
gchar *str[]={"222222", 0};
gtk_init(&argc, &argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "GtkList Example");
gtk_signal_connect(GTK_OBJECT(window),
"destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
vbox=gtk_vbox_new(FALSE, 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
gtk_widget_set_usize(scrolled_window, 250, 150);
gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
gtk_widget_show(scrolled_window);
gtklist=gtk_clist_new(0);
gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(scrolled_window),
gtklist);
gtk_widget_show(gtklist);
button = gtk_button_new_with_label("change row");
gtk_container_add(GTK_CONTAINER(vbox), button);
gtk_widget_show(button);
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(funct),
GTK_OBJECT(window));
for(i = 0; i< 100; i++)
gtk_clist_append(GTK_CLIST(gtklist), str);
gtk_widget_show(window);
gtk_main();
return(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]