From: Marco Antoniotti
Subject: Help Needed.  Harlequin Personal Edition CAPI.
Date: 
Message-ID: <lwyagdgfqt.fsf@copernico.parades.rm.cnr.it>
Hi,

I am playing around with the Harlequin PE on Windows.  I am starting
to use CAPI system and I am somewhat confused.  Basically I want to be
able to access the width and height of an element, but I do not see
any way to do so in an easy way.

E.g.

I have a CAPI:EDITOR pane I created with

	(defvar ep (make-instance 'capi:editor-pane))

Now, I want to get its width and height.  It looks like the only way
to do so is

	(capi:with-geometry ep
           (values capi:%width% capi:%height%))

It is correct?

Also, these values are NIL if the containing CAPI:INTERFACE
has not been DISPLAYed.  Is there a way to have a widget tree
'realized' (in X/Xt parlance) before being 'mapped'?

Thanks for any help you could give me.

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa

From: Lieven Marchand
Subject: Re: Help Needed.  Harlequin Personal Edition CAPI.
Date: 
Message-ID: <m3pv1ojzz8.fsf@localhost.localdomain>
Marco Antoniotti <·······@copernico.parades.rm.cnr.it> writes:

> Now, I want to get its width and height.  It looks like the only way
> to do so is
> 
> 	(capi:with-geometry ep
>            (values capi:%width% capi:%height%))
> 
> It is correct?
> 

(values (gp:port-width ep) (gp:porth-height ep))

> Also, these values are NIL if the containing CAPI:INTERFACE
> has not been DISPLAYed.  Is there a way to have a widget tree
> 'realized' (in X/Xt parlance) before being 'mapped'?

I haven't found one. Perhaps something using WITH-ATOMIC-DISPLAY and
then cancelling the update at the end?

-- 
Lieven Marchand <···@bewoner.dma.be>
If there are aliens, they play Go. -- Lasker
From: Robert Monfera
Subject: Re: Help Needed.  Harlequin Personal Edition CAPI.
Date: 
Message-ID: <3794D38D.F75511AD@fisec.com>
Lieven Marchand wrote:
> 
> Marco Antoniotti <·······@copernico.parades.rm.cnr.it> writes:
> 
...
> > Also, these values are NIL if the containing CAPI:INTERFACE
> > has not been DISPLAYed.  Is there a way to have a widget tree
> > 'realized' (in X/Xt parlance) before being 'mapped'?
> 
> I haven't found one. Perhaps something using WITH-ATOMIC-DISPLAY and
> then cancelling the update at the end?

Based on the doc (GP), you can output to a port (kind of frame buffer)
that you do not display, and display the port after. Haven't tried it
though.

Robert
From: Marco Antoniotti
Subject: Re: Help Needed.  Harlequin Personal Edition CAPI.
Date: 
Message-ID: <lwbtd6e6nf.fsf@copernico.parades.rm.cnr.it>
Robert Monfera <·······@fisec.com> writes:

> Lieven Marchand wrote:
> > 
> > Marco Antoniotti <·······@copernico.parades.rm.cnr.it> writes:
> > 
> ...
> > > Also, these values are NIL if the containing CAPI:INTERFACE
> > > has not been DISPLAYed.  Is there a way to have a widget tree
> > > 'realized' (in X/Xt parlance) before being 'mapped'?
> > 
> > I haven't found one. Perhaps something using WITH-ATOMIC-DISPLAY and
> > then cancelling the update at the end?
> 
> Based on the doc (GP), you can output to a port (kind of frame buffer)
> that you do not display, and display the port after. Haven't tried it
> though.

That is to say?

Once again (and maybe somebody from Harlequin could comment on this) I
have a button I created with

	(setf pb (make-instance 'push-button :text "I am your button"))

I want to know how much space it will (may) take on the screen
*without* doing anything like

	(contain pb)

I need this because I am designing my own layout which needs (don't
ask me why - it's my business) to know the "best" size for the
children *before* actually doing the display.

I thought the CAPI:CALCULATE-CONSTRAINTS may fill the bill, but it
turns out that the internal rep of the object (the font in particular)
is not there (it is NIL) and causes an error (method not found).

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa
From: Marco Antoniotti
Subject: Re: Help Needed.  Harlequin Personal Edition CAPI.
Date: 
Message-ID: <lwd7xnpx9b.fsf@copernico.parades.rm.cnr.it>
Lieven Marchand <···@bewoner.dma.be> writes:

> Marco Antoniotti <·······@copernico.parades.rm.cnr.it> writes:
> 
> > Now, I want to get its width and height.  It looks like the only way
> > to do so is
> > 
> > 	(capi:with-geometry ep
> >            (values capi:%width% capi:%height%))
> > 
> > It is correct?
> > 
> 
> (values (gp:port-width ep) (gp:porth-height ep))

Ok, but why resort to "lower" level functions when you can use the
"CAPI" form?
> 
> > Also, these values are NIL if the containing CAPI:INTERFACE
> > has not been DISPLAYed.  Is there a way to have a widget tree
> > 'realized' (in X/Xt parlance) before being 'mapped'?
> 
> I haven't found one. Perhaps something using WITH-ATOMIC-DISPLAY and
> then cancelling the update at the end?

I thought so, but you may get "flickering" problems, don't you (I have
not tried).

Cheers


-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa
From: Robert Monfera
Subject: Re: Help Needed.  Harlequin Personal Edition CAPI.
Date: 
Message-ID: <37937666.6B62CF30@fisec.com>
Marco Antoniotti wrote:

> Now, I want to get its width and height.  It looks like the only way
> to do so is
> 
>         (capi:with-geometry ep
>            (values capi:%width% capi:%height%))
> 
> It is correct?

I use it this way too.

> Also, these values are NIL if the containing CAPI:INTERFACE
> has not been DISPLAYed.  Is there a way to have a widget tree
> 'realized' (in X/Xt parlance) before being 'mapped'?

Being unfamiliar with Xt, I would say you can set the width and height
values before displaying them.  I used, however, a custom grid layout
where my algorithm controlled the layout (rectangles) of the components
based on min- and max- values and the amount of text in the components.
I am not sure if this answers the question - I can send some code
snippets.

Robert