2017-05-23 5 views
1

Ich habe Code geschrieben, um eine GUI in swi-prolog zu erstellen, aber mein Hauptfenster ist zu klein für alle meine Schaltflächen und Textfelder. Wie kann ich zum Beispiel das 6. Funktionsergebnis in der "zweiten Spalte" zeichnen, genau auf der rechten Seite des 1. Ergebnisses?Größe und Position der GUI-Elemente festlegen

showForm :- 
    new(W, window('Test', size(800, 800))), 
    new(D, dialog('Main window', size(800, 800))), 

    /* 6) serach if country is in Europe */ 
    new(Etiq, text_item('1) Enter country here:')), 
    send(D, append, Etiq), 
    new(Result, label), 
    send(D, append, Result), 
    send(D, append, button(search, message(@prolog, memberCountry, Etiq, Result))), 


    /* 7) Path form-to (serach in deep) */ 
    new(Path1, text('6) Path form-to (serach in deep)')), 
    new(From1, text_item('Enter country FROM here:')), 
    new(To1, text_item('Enter country TO here:')), 
    send(D, append, Path1), 
    send(D, append, From1), 
    send(D, append, To1), 

    send(Path1, right, Etiq), 

    new(Path1Res, label), 
    send(D, append, button(path, message(@prolog, dfs, From1, To1, [], Path1Res))), 
    send(D, append, Path1Res), 

% ..... 

send(D, below, W), 
    send(D, open), 
    !. 

enter image description here

+2

können Sie XPCE Dialog-Editor verwenden. – joel76

Antwort

3

Werfen Sie einen Blick auf dialog_group:

showForm :- 
    %new(W, window('Test', size(800, 800))), 
    new(D, dialog('Main window', size(800, 800))), 
    new(H1, dialog_group(' ')), 
    new(H2, dialog_group(' ')), 
    send(D, append, H1), 
    send(D, append, H2, right), 

    /* 6) serach if country is in Europe */ 
    new(Etiq, text_item('1) Enter country here:')), 
    send(H1, append, Etiq), 
    new(Result, label), 
    send(H1, append, Result), 
    send(H1, append, button(search)), 


    /* 7) Path form-to (serach in deep) */ 
    new(Path1, text('6) Path form-to (serach in deep)')), 
    new(From1, text_item('Enter country FROM here:')), 
    new(To1, text_item('Enter country TO here:')), 
    send(H2, append, Path1), 
    send(H2, append, From1), 
    send(H2, append, To1), 

    new(Path1Res, label), 
    send(D, append, button(path)), 
    send(D, append, Path1Res), 

    send(D, open). 

enter image description here

Verwandte Themen