For Programmers: Free Programming Magazines  


Home > Archive > Prolog > February 2005 > Swi-Pce: text items too large









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Swi-Pce: text items too large
Maurizio Ferreira

2005-01-31, 3:59 pm

the following program exibits a strange behaviour :
the horizontal size of the text_items seems exagerately large.
if I remove the 'right' specifier in the second append clause, the
sizes are correct (but not the placement)

Any suggestion ?
(I' using vers 5.4.6 under win2k)

Regards
Maurizio


go:-
new(D, dialog('example')),

send(D, append, text_item('first')),
send(D, append, text_item('second'),right),
send(D, append, text_item('third'),next_row),
send(D, append, text_item('fourth')),

send(D, append, button('ok', message(D, return, @nil))),
get(D, confirm, _),
send(D, destroy).


Jan Wielemaker

2005-01-31, 3:59 pm

On 2005-01-31, Maurizio Ferreira <maurizio.ferreira@selesta.it> wrote:
> the following program exibits a strange behaviour :
> the horizontal size of the text_items seems exagerately large.
> if I remove the 'right' specifier in the second append clause, the
> sizes are correct (but not the placement)
>
> Any suggestion ?
> (I' using vers 5.4.6 under win2k)
>
> Regards
> Maurizio
>
> go:-
> new(D, dialog('example')),
>
> send(D, append, text_item('first')),
> send(D, append, text_item('second'),right),
> send(D, append, text_item('third'),next_row),
> send(D, append, text_item('fourth')),
>
> send(D, append, button('ok', message(D, return, @nil))),
> get(D, confirm, _),
> send(D, destroy).


Looks like a bug. The placement algorithm is unstable in
this case and keeps enlarging the items. Placement is optimised
iteratively until the result is stable or the max of 3 iterations
is passed. I'll have a look, but not right now. There are a
lot of variables to play with though and the following works:

send(D, append, new(TI1, text_item('first'))),
send(D, append, new(TI2, text_item('second')), right),
send(D, append, text_item('third'), next_row),
send(D, append, text_item('fourth')),
(1) send(TI1, hor_stretch, 0),
(2) send(TI2, alignment, left),

The (1) marked line tells it not to stretch this field and
the (2) not to create a second column. It is curious that
just using one of them doesn't make it behave though.

Cheers --- Jan



Maurizio Ferreira

2005-02-01, 8:59 am

well, it works.
A side effect, however, is that if I insert the following line
send(D, resize_message, message(D, layout, @arg2)),

when I resize the dialog the first field is not resized,
but I can live with that.

Thanks.

Maurizio.



On 31 Jan 2005 16:32:08 GMT, Jan Wielemaker <jan@ct.xs4all.nl> wrote:

>On 2005-01-31, Maurizio Ferreira <maurizio.ferreira@selesta.it> wrote:
>
>Looks like a bug. The placement algorithm is unstable in
>this case and keeps enlarging the items. Placement is optimised
>iteratively until the result is stable or the max of 3 iterations
>is passed. I'll have a look, but not right now. There are a
>lot of variables to play with though and the following works:
>
> send(D, append, new(TI1, text_item('first'))),
> send(D, append, new(TI2, text_item('second')), right),
> send(D, append, text_item('third'), next_row),
> send(D, append, text_item('fourth')),
>(1) send(TI1, hor_stretch, 0),
>(2) send(TI2, alignment, left),
>
>The (1) marked line tells it not to stretch this field and
>the (2) not to create a second column. It is curious that
>just using one of them doesn't make it behave though.
>
> Cheers --- Jan
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com