1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| % le code de termine2 adapté pour écrire dans l'editeur
termine2(Infinitif, Editor) :-
racine(Infinitif,Racine,_Suffixe),
forall( terminaison(Debut,Fin),
( name(Deb,Debut),
append(Racine,Fin,Verbe), name(V,Verbe),
format(atom(A), '~w ~w~n', [Deb, V]),
send(Editor, append, A))).
% le prédicat apellé par le bouton
conjugaison(Atom, Editor) :-
send(Editor, clear),
name(Atom, Infinitif),
racine(Infinitif,_Racine,_Suffixe), termine2(Infinitif, Editor).
% le code de la boîte de dialogue
dialog(my_dialog,
[ object :=
My_dialog,
parts :=
[ My_dialog := dialog('My dialog'),
Text_item := text_item(text_item),
Editor := editor(@default, 32, 8),
Button := button(button)
],
modifications :=
[ Text_item := [ label := 'Verbe à conjuguer',
length := 28
],
Button := [ label := 'Go'
]
],
layout :=
[ area(Text_item,
area(28, 20, 322, 24)),
area(Editor,
area(30, 68, 327, 150)),
area(Button,
area(380, 22, 80, 24))
],
behaviour :=
[ Button := [ message := message(@prolog,
conjugaison,
Text_item?selection,
Editor)
]
]
]).
% le prédicat de lancement du programme
go :-
make_dialog(D, my_dialog),
send(D,open). |
Partager