~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fpcdocs/gtk1ex/ex5.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
program ex5;
 
2
 
 
3
{$mode objfpc}
 
4
 
 
5
uses
 
6
 glib,gtk;
 
7
 
 
8
procedure destroy(widget : pGtkWidget ; data: pgpointer ); cdecl;
 
9
begin
 
10
  gtk_main_quit();
 
11
end;
 
12
 
 
13
var
 
14
  window : PGtkWidget;
 
15
  button : PGtkWidget;
 
16
 
 
17
begin
 
18
  gtk_init (@argc, @argv);
 
19
  window := gtk_window_new (GTK_WINDOW_TOPLEVEL);
 
20
  button := gtk_button_new_with_label('Click me');
 
21
  gtk_container_set_border_width(GTK_CONTAINER(Window),5);
 
22
  gtk_container_add(GTK_Container(window),button);
 
23
  gtk_signal_connect (PGTKOBJECT (window), 'destroy',
 
24
                      GTK_SIGNAL_FUNC (@destroy), NULL);
 
25
  gtk_signal_connect_object(PGTKOBJECT(button),'clicked',
 
26
                      GTK_SIGNAL_FUNC(@gtk_widget_destroy),
 
27
                      PGTKOBJECT(window));
 
28
  gtk_widget_show (button);
 
29
  gtk_widget_show (window);
 
30
  gtk_main ();
 
31
end.