Hello,
I am looking for help with my XPCE-GUI.
I’m using: SWI-Prolog version 8.4.3
I want the code to: Show a graphical user interface with 10 columns that fits onto my screen.
But what I’m getting is: My user interface does not fit onto the screen! The columns 9 and 10 are not shown and there is no way to access them, because the window has no horizontal scrolling option.
I tried changing the dialog size. Using the property “size(200,200)” in line 3 of the source code does not change the size of the dialog. If I change it to i.e. “size(20, 20)”, the size does not change.
I tried changing the text box sizes with “width”. The text boxes can be shortened by this, however XPCE still seems to reserve the same amount of space for each column, regardless of text item width.
- How can I squeeze the columns closer together?
- Is there a way to implement a horizontal menu bar that allows to access elements that do not fit onto the screen?
My code looks like this:
:- use_module(library(pce)).
t1:-new(D,dialog('GUI', size(200, 200))),
new(H1, dialog_group(' Caption1 ')),
new(HN1, text_item('cn1','')),
send(HN1, width,40),
send(HN1,show_label,false),
send(H1, append, HN1,right),
send(D, append, H1),
new(H2, dialog_group(' Caption2 ')),
column(C1,0,group,"Cpt1",'test1'),
column(C2,1,group,"Cpt2",'test2'),
column(C3,1,group,"Cpt3",'test3'),
column(C4,1,group,"Cpt4",'test4'),
column(C5,1,group,"Cpt5",'test5'),
column(C6,1,group,"Cpt6",'test6'),
column(C7,1,group,"Cpt7",'test7'),
column(C8,1,group,"Cpt8",'test8'),
column(C9,1,group,"Cpt9",'test9'),
column(C10,1,group,"Cpt10",'test10'),
row(RowAll,group,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10),
send(H2,append,RowAll),
send(D, append, H2, below),
send(D,open).
column(C,0,Type,Labeltext1,Labeltext2) :-
new(C,dialog_group('Col1',Type)),
new(Lab1,label(lab_1_0,Labeltext1)),
send(C, append, Lab1),
send(C, append, label(lab_1_1,Labeltext2), below),
send(C,gap,size(1,0)),
new(CN1, text_item('cn1','')),
send(CN1, width,20),
send(CN1,show_label,false),
send(C, append, CN1,below),
new(CN2, text_item('cn2','')),
send(CN2, width,20),
send(CN2,show_label,false),
send(C, append, CN2,below),
new(CN3, text_item('cn3','')),
send(CN3, width,20),
send(CN3,show_label,false),
send(C, append, CN3,below),
new(CN4, text_item('cn4','')),
send(CN4, width,20),
send(CN4,show_label,false),
send(C, append, CN4,below),
new(CN5, text_item('cn4','')),
send(CN5, width,20),
send(CN5,show_label,false),
send(C, append, CN5,below),
new(CN6, text_item('cn4','')),
send(CN6, width,20),
send(CN6,show_label,false),
send(C, append, CN6,below).
column(C,1,Type,Labeltext1,Labeltext2) :-
new(C,dialog_group('Col1',Type)),
send(C,gap,size(1,0)),
new(Lab1,label(lab_1_0,Labeltext1)),
send(C, append, Lab1),
send(C, append, label(lab_1_1,Labeltext2), below),
new(CN1, text_item('cn1','')),
send(CN1, width,10),
send(CN1,show_label,false),
send(C, append, CN1,below),
new(CN2, text_item('cn2','')),
send(CN2, width,10),
send(CN2,show_label,false),
send(C, append, CN2,below),
new(CN3, text_item('cn3','')),
send(CN3, width,10),
send(CN3,show_label,false),
send(C, append, CN3,below),
new(CN4, text_item('cn4','')),
send(CN4, width,10),
send(CN4,show_label,false),
send(C, append, CN4,below),
new(CN5, text_item('cn4','')),
send(CN5, width,10),
send(CN5,show_label,false),
send(C, append, CN5,below),
new(CN6, text_item('cn4','')),
send(CN6, width,10),
send(CN6,show_label,false),
send(C, append, CN6,below).
row(R,Type,Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10) :-
new(R,dialog_group('ColAll',Type)),
%send(R,gap,size(1,1)),
send(R, append, Column1, right),
send(R, append, Column2, right),
send(R, append, Column3, right),
send(R, append, Column4, right),
send(R, append, Column5, right),
send(R, append, Column6, right),
send(R, append, Column7, right),
send(R, append, Column8, right),
send(R, append, Column9, right),
send(R, append, Column10, right).
The resulting GUI does not fit to the screen, e.g. it is cut off on the right and does not display the last two columns:
I am looking forward to read advice from a prolog programmer that is more experienced than I am!
Malo