lablgtk2 tutorial

This is ocaml adaptation of the GTK+ 2.0 Tutoirial.

The old tutorial and source of the examples used in this document can be found here.

    Introduction

    Introduction

    Getting started

    To begin our introduction to GTK, we'll start with the simplest program possible.

    Moving on

    More on signal handlers

    Packing widgets

    When creating an application, you'll want to put more than one widget inside a window.

    Widget overview

    The general steps to creating a widget in GTK are ...

    Creating Widgets

    You create a widget by ...

    Button widget

    We've almost seen all there is to see of the button widget. It's pretty simple. There is however more than one way to create a button.

    Adjustments

    GTK has various widgets that can be visually adjusted by the user using the mouse or the keyboard, such as the range widgets, described in the Range Widgets section.

    Range widgets

    The category of range widgets includes the ubiquitous scrollbar widget and the less common scale widget.

    Miscellaneous widgets

    Labels, arrows, tooltips, progress bars, dialog widgets, ...

    Container widgets

    EventBox, Alignment widget, fixed container, layout container, ...

    Menu widgets

    There are two ways to create menus: there's the easy way, and there's the hard way. Both have their uses, but you can usually use the Itemfactory (the easy way).

    Undocumented widgets

    These all require authors! :) Please consider contributing to our tutorial.

    Setting widget attributes

    This describes the functions used to operate on widgets. These can be used to set style, padding, size, etc.

    Timeouts and idle functions

    Timeouts and idle functions

    Advanced event and signal handling

    Advanced event and signal handling

    Clipboard

    Text copy and paste is a good example of clipboard widget. You can do inter-processor communication throuth the widget.

    Drag-and-drop

    GTK+ has a high level set of functions for doing inter-process communication via the drag-and-drop system. GTK+ can perform drag-and-drop on top of the low level Xdnd and Motif drag-and-drop protocols.

    GTK's rc files

    GTK has its own way of dealing with application defaults, by using rc files. These can be used to set the colors of just about any widget, and can also be used to tile pixmaps onto the background of some widgets.

    Scribble, drawing program

    In this section, we will build a simple drawing program. In the process, we will examine how to handle mouse events, how to draw in a window, and how to do drawing better by using a backing pixmap.

    Contributing

    This document, like so much other great software out there, was created for free by volunteers. If you are at all knowledgeable about any aspect of GTK that does not already have documentation, please consider contributing to this document.

    Credits

    We would like to thank the following for their contributions to this text.

    Tutorial copyright and permissions notice

comments powered by Disqus