0

I have a function that calculates all possible outcomes to a given equation in a given range. It needs 4 values that can be ints or unknown. I am trying to add some kind of GUI to let user input those values and get a result. I am not able to get any result from a function through GUI button, even though it passess input numbers. How can I run my function (oblicz) and get results to show up anywhere? I just want to input values and make the function run like you normally would without GUI. Here is my code:

:-use_module(library(pce)).
usun(X,[X|Reszta],Reszta).
usun(X,[Y|Ogon],[Y|Reszta]):-
    usun(X,Ogon,Reszta).
niewiadome(X,L,L1):-
    usun(X,L,L1).
oblicz(A,B,C,D):-
    numlist(-50,50,L),
    niewiadome(A,L,_),niewiadome(B,L,_),niewiadome(C,L,_),niewiadome(D,L,_),
    A+B-C-3*D=:=2,
    A+B+C-2*D=:=24,
    A-B+C-D=:=12.

licz:- new(P, dialog('Obliczanie układów równań')),
    new(F,int_item('Podaj 1 niewiadomą')),
    new(G,int_item('Podaj 2 niewiadomą')),
    new(H,int_item('Podaj 3 niewiadomą')),
    new(J,int_item('Podaj 4 niewiadomą')),

    send(P, append, F),
    send(P, append, G),
    send(P, append, H),
    send(P, append, J),
    send(P, append, new(button('Gotowe',
    message(@prolog, oblicz, F, G, H, J)))),

    send(P, append, button('koniec',
    message(@prolog,zamknij,P))),

    send(P,open).

zamknij(P):-send(P, destroy).

false
  • 10,264
  • 13
  • 101
  • 209

0 Answers0