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
|
mon_premier_program :-
% on crée la fenêtre
new(D, dialog('Ma première fenêtre')),
new(Etiq, label(nombre,'System expert')),
new(T, text_item(hello)),
new(Text1, text_item(afficher_ici)),
% on crée un composant texte,
send(D, append,Etiq),
send(D, append, T),
send(D, append, Text1),
send(D, append, button(ok,
message(@prolog, regle, T ))),
send(D, append, button(affiche,
message(@prolog, affiche, Text1))),
send(D, append, button( cancel,
message(@prolog, end, D) ) ),
send(D, open).
%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ! %%% %fonction d lecture %%%%%%%%%%%%
my_read(Str, L) :-
% send(Text1, selection, ""),
read_line_to_codes(Str, T),
( T = end_of_file -> L = [];
atom_codes(T1, T),
my_read(Str, L1), L = [T1 | L1]).
%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
affiche(Text):-
open('C:/Users/...../System/cc.txt',read,Str),
my_read(Str,CC1),
close(Str),
writeln(CC1),nl,
send(Text,selection ,CC1).
regle(T):- get(T, value, Text), writeln(Text).
end(D):- send(D, destroy).
%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
Partager