) Camldsgn.


Figure 1

5.1) Introduction.

Camldsgn allows you to place and configure all the Camlwin objects in a window with the mouse. It saves a caml file and a special file. The first one is for a caml project, and the second is used to reload the designed window. So, if you modify the caml file, the modifications will be erased if you load and save the window another time.

5.2) Add, place, resize objects.

First, you must load a window or create a new one. This is done with the menu File: When you create a new design window, the characteristic window is open (Figure 1)


Figure 1

The characteriristics are:

You add an object by pushing the corresponding button in the Camldsgn window. The object is added in the center of the design window. Each object is splited in two parts: the left and the right part. The left part is devoted to the placement, the right part is devoted to the resizement. You drag an object to its final position by pressing the mouse button in the left part of the object. During the movement, four black squares point to the new object area. You drag the lower right corner of the object by pressing the mouse button in the right part of the object. The upper left corner of the object stills at the same place, the lower rigth follows the mouse mouvement.

If an object can't be resized (prompt, for example), you can move them by clicking in the whole object. Some objects can be resized on one direction only (for example: string editors, scrollbars...), so mouse movements in this direction are ignore.

If you click in an object without move or resize it, the configuration window of the object is opened.

5.3) The Window menu and the objects window.

the menu Window is:


Figure 2

The objects window gives the list of all the objects od the designed window. You can select one object, and with the button Edit, opens the configuration window of this object.

If you want to remove an object, select the object in the list, and press the Del button. It's the only way to remove an object of the designed window.

5.4) Configure objects

Each object of camlwin have a configuration window in camldsgn. It must have an unique name, used to define it in the camlwin programs. All the parameters of an object (except size and position) can be modified with its corresponding window. Just some of the configuration windows are explained here, the others follow the sames principles.

5.4.1) Configure buttons.


Figure 2

The Id name field is the name of the object in the caml program generated by Camldsgn. The Name field is the content of the button. The type of this field is defined by the three buttons Text, Image, Integer. When you press the Edit button in front of this field, Camldsgn open a new window. This window is an input string window if the type is set to text. It is the Camlicon window if the type is set to image. It is an input integer window if the type is set to integer.

The Callback function name is defined in the field Callback. The name can be modified in this window, but if you do so, you must edit the new function, by pressing Edit button in front of this field. Otherwise, you will have a compilation error when you compile the generated file.

The Cancel button close the window, but all the changes you made are forgoten. The Ok button close the window, and update the design window.

5.4.2) Configure toolbar.


Figure 2

The left part of the window is devoted to menu, the right part to the items of the selected menu.

The three buttons in the left Add, Del, Edit managed menus. A menu is added at the end of the list, so displayed at the right of the toolbar. Configure a menu is simply choosing an Id name and a Name(the label dispalyed in the toolbar).

The three buttons in the right Add, Del, Edit managed the items of the selected menu. An item is added at the end of the list. Configure an item is choosing an Id name, a Name and a Callback function.

At the bottom of the window, there is a field that content the toolbar Id name, and a button to close the window.

5.4.3) Configure group of buttons.


Figure 2

With the mouse, you can only move and size the box surrounding all the buttons. The size of the buttons, and there relative position are set in the configure window.

As for all the objects, you have to choose an Id name. You can also specify and edit a Callback function.

The three fileds bellow configure the position and the sizes of the buttons. The sizes are in the fields Button size: width and Button size: height. The field Delta gives the the length between two buttons, verticaly and horizontaly.

The list gives the content of the buttons. You can add a button after the selected one by pressing Add. You can add a button before the selected one by pressing Ins. You can remove a button by pressing Del. When you add a button, a window asks you to select the type of the content of the new button (string, integer, image), and then let you edit the content. You can change the content (but not the type) of the selected button by pressing the button Edit.

The last field is for choosinf the way of filled the group of buttons.

There is no garanty that all the buttons stay in the surrounded box. You must resize it by hand.

5.4) The Function menu and the functions window.

The menu Functions is:


Figure 2

You can edit or remove a function with the two buttons Edit and Del. Camldsgn doesn't check if all the callbacks of the objects have a corresponding function definition.

) The ml file format.

The ml file generated by camldsgn is as follow:
#open "windows";;
#open "camlwin";;

#open "image1";;
...
#open "imagen";;


let win_def =
{
...
};;

let obj1 =
{
...
};;

let obj2 =
{
...
};;

...

let item1 =
{
...
};;

...

let itemn =
{
...
};;

let menu1 =
{
...

};;

...

let toolb = 
{
...
};;

let win =
{

};;

let func1 Obj Event =
...
;;

...

obj1.xx_callback <- func1;;
...
The objects are saved in the Camlwin order, except the items and the menus. They are saved after all the others objects. Then the window is defined, and all the functions are added to the file. The file ends with the callback asignement. So that, you can used objects in the callback functions.