Re: Help (Please)
- From: Rasoul Hajikhani <rhajikhani exchange office etoys com>
- To: John Cupitt <john cupitt ng-london org uk>
- Cc: gtk-list gnome org
- Subject: Re: Help (Please)
- Date: Wed, 22 Nov 2000 15:36:46 -0800 (PST)
GtkWidget *create_interface(void)
532 {
533 static Hybrid *hybrid = NULL;
534
535 GtkWidget *w, *main_box, *progress, *m_frame, *menu_table,
*button, *opt, *menu, *quitbox, *label, *separator;
536
GtkWidget *scrolled_window, *vbox, *table;
537
538 hybrid = g_malloc( sizeof(Hybrid) );
539 g_assert (hybrid != 0);
/* some where I do this */
hybrid->scrolled_window = create_scrolled_window();
GtkWidget *create_scrolled_window (void)
513 {
514
515 GtkWidget *scrolled_window;
516
517 scrolled_window = gtk_scrolled_window_new (NULL,
NULL);
518 gtk_container_set_border_width (GTK_CONTAINER
(scrolled_window),
_TEN);
519 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
(scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
522 gtk_widget_set_usize( GTK_WIDGET
(scrolled_window), XSIZE,
_FOURH);
523
524
525 return scrolled_window;
}
Then after time out, and the call to data base I do this:
update_scrolled_window(hybrid);
gint update_scrolled_window (Hybrid *hybrid)
103 {
104 GtkWidget *table;
105
106 if (hybrid->table == NULL)
107 {
108 create_table(hybrid);
109
110 /*gtk_widget_show(hybrid->table);*/
111 gtk_scrolled_window_add_with_viewport
(GTK_SCROLLED_WINDOW (hybrid->scrolled_window), hybrid->table);
112 gtk_container_set_focus_hadjustment
(GTK_CONTAINER (hybrid->table),
113
gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW
(hybrid->scrolled_window)));
114
115 gtk_container_set_focus_vadjustment
(GTK_CONTAINER (hybrid->table),
116
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
(hybrid->scrolled_window)));
117 }
118 return FALSE;
119 }
And here I build the table refered to on line# 108 above
gint create_table (Hybrid *hybrid)
38 {
39
40 GtkWidget *vrule, *lh, *lable, *table;
41 int col, row;
42
43 ServerData *current = NULL;
44
45 current = g_malloc( sizeof(ServerData) );
46 current = hybrid->sd;
47
48 table = gtk_table_new(_TWO, hybrid->count, TRUE);
49
50 vrule = gtk_vruler_new();
51 gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
52 gtk_ruler_set_range( GTK_RULER(vrule),
ceil(hybrid->max_load) + _FIVE, _NON,
hybrid->max_load, _TWOH );
53 gtk_table_attach_defaults( GTK_TABLE(table),
54 vrule,
55 _NON,
56 _ONE,
57 _NON,
58 _ONE);
59
60
61 gtk_table_set_col_spacings( GTK_TABLE (table),
62 _FIVE);
63
64 col = row = 1;
65
66 while ( current != NULL )
67 {
68 lh = gtk_level_hold_new( _TWOH,
69 _TEN,
70 GTK_LEVEL_HOLD_FADE,
71 _EIGHT,
72 _THREE,
73 _TWO);
74
75 gtk_table_attach_defaults( GTK_TABLE(table),
76 lh,
77 col,
78 col + _ONE,
79 _NON,
80 _ONE);
81
lable = gtk_label_new (current->name);
85 gtk_table_attach_defaults( GTK_TABLE(table),
86 lable,
87 row,
88 row + _ONE,
89 _ONE,
90 _TWO);
91 gtk_timeout_add(1000, update_bars,lh);
92 col++;
93 row++;
94 current = current->nextptr;
95 }
96 g_free(current);
97 hybrid->table = table;
98
99 return FALSE;
}
I am sorry for this thing being so big and nasty, but I thought if you saw
it, may be you may have a clue...
Thanks in advance
-r
On Wed, 22 Nov 2000, John Cupitt
wrote:
> (I mailed you directly, but it bounced ... so it's on the list)
>
> Hi Rasoul,
>
> > when my application starts, I create a progress bar (Hybrid->progressbar),
> > a table with row=1 column=1, and a scrolling window. I place a reference
> > to this table in my Hybrid->table data structure. I insert the table
> > Hybrid->table in the scrolling window. After progressbar timer iterates
> > once, I call update_records function which retrieves the records from tha
> > data base and they are inserted into the linked list. The Hybrid data
> > structure is then used in the update_table function to get access to both
> > the linked list and the table to update the table by placing the levelhold
> > widgets in the appropriate rows and columns (supposedly). But it never
> > happens and I never see the levelhold widgets. Can any one help me and
> > tell me where I have gone wrong...
>
> So many things could have gone wrong :( it's hard to say from your
> description.
>
> Try to make a small example program which you can post which shows the
> problem, or take the progressbar example in testgtk and hack that about.
>
> HTH, John
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]