Simple Newbie Question: Draw a line in a window




Hi all,

First of all, thanks to all, who sent me hints, upon my first post.  he problem is not quite rectified though:

	I am trying to open a window,
	show it,
	"then" draw a line in it,
	(later draw other things in it),
	and watch while the line (and other figures) are sequentially drawn.

The following simple code, creates a window, which appears for a fraction of a second, then disappears; and I get the following error message:

simple-line-in-window.c: In function `main':
simple-line-in-window.c:13: warning: passing arg 1 of `gdk_draw_line' from incompatible pointer type
** ERROR **: sigsegv caught

I know, that gdk_draw_line(...) expects a GdkWindow instead of the GtkWindow.  How do I remedy that? And what else do I need to change to make it work?

Many TIA,

khosro
=============================================================================

#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *window;

  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_show (window);
  gdk_draw_line (window,
                 window->style->black_gc,
                 100, 50, 50, 100);
  gtk_main ();
  return 0;
}









[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]