Project

General

Profile

Create a window in Scol » History » Version 1

iri, 10/01/2012 09:43 PM

1 1 iri
h1. Create a window in Scol
2
3
A window is a base of all graphic interface ; it is a container. The Scol type is *ObjWin*.
4
5
h2. Creation
6
7
To create a window, simple use the Scol function "*_CRwindow*":http://www.scolring.org/files/doc_html/_crwindow.html
8
9
<window_object> *_CRwindow* <channel_object> <father_object> <initial_position_x> <initial_position_y> <initial_width> <initial_height> <option_flags> <title>
10
11
# <channel_object> : the proprietary channel. If nil, the windown can *not* be created, if the channel os closed, the window will be destroyed. Typically, it is the current channel (__channel_)
12
# <father_object> : the parent window, if any. If no parent, you should set to nil this argument.
13
# <initial_position_x>
14
# <initial_position_y>
15
# <initial_width>
16
# <initial_height> : position and size when the window is created
17
# <option_flags> : several flags are availables to customize the window (see "doc":http://www.scolring.org/files/doc_html/_crwindow.html)
18
# <title> : a title, if any
19
20
You can directly hide a window. In this case, don't forget to show it when needed ("_SHOWwindow":http://www.scolring.org/files/doc_html/_showwindow.html) !
21
22
You can also create a window object with scroll : "_CRscrollWindow":http://www.scolring.org/files/doc_html/_crscrollwindow.html
23
24
h2. Destruction
25
26
To destroy a window object, use "_DSwindow":http://www.scolring.org/files/doc_html/_dswindow.html
27
28
<integer> *_DSwindow* <object_window>
29
30
If the <object_window> is already destroyed, nothing to do. If the <object_window> is stored in a global variable, you should always set it to nil *after* the destruction of the object.
31
32
h2. Example :
33
34
<pre>typeof window = ObjWin;;
35
36
fun end ()=
37
    _DSwindow window;
38
    _closemachine;;
39
40
fun create ()=
41
    set window = _CRwindow _channel nil 0 0 320 240 WN_NORMAL "My first window !";
42
    _fooS if window == nil then
43
              "Unable to create this window"
44
          else
45
              "The window has been created";
46
    0;;
47
48
fun main ()=
49
    _showconsole;
50
    create;
51
    // other things
52
    0;;
53
</pre>