ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Fixed width form field
@ 1999-10-12 14:09 Matthew Baker
  1999-10-12 17:35 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Baker @ 1999-10-12 14:09 UTC (permalink / raw)


Hallo,

I want to design a form in which fields appear in table cells so that they
line up correctly.  In order to deal with baseline alignment and things, I
use the label field in the form.  I have a macro like

\def\putfield[#1]#2{\hbox{\field[#1][#2]}}

I would like the field to extend to fill the table cell (which I set to a
fixed size with the w table format option).  How can I set the field up to
fit to this size?  I can't simple set the field width to the desired size
because I don't know how long the label is.  I'd like ideally to set the
width of the frame around the field to something fixed and then set the
label and field widths to "fit", eg

\setupfield [MyFieldSetup] [frame, label, horizontal] [width=60mm]
  [width=fit] [width=fit]

But that doesn't work.  Any way to do this?

- Matt

--
Dr. Matthew Baker           matthew.baker@gmd.de
GMD - FIT.MMK               http://fit.gmd.de/hci/pages/matthew.baker.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fixed width form field
  1999-10-12 14:09 Fixed width form field Matthew Baker
@ 1999-10-12 17:35 ` Hans Hagen
  1999-10-15 13:16   ` Matthew Baker
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 1999-10-12 17:35 UTC (permalink / raw)


Matthew Baker wrote:

> I want to design a form in which fields appear in table cells so that they
> line up correctly.  In order to deal with baseline alignment and things, I
> use the label field in the form.  I have a macro like
> 
> \def\putfield[#1]#2{\hbox{\field[#1][#2]}}
> 
> I would like the field to extend to fill the table cell (which I set to a
> fixed size with the w table format option).  How can I set the field up to
> fit to this size?  I can't simple set the field width to the desired size
> because I don't know how long the label is.  I'd like ideally to set the
> width of the frame around the field to something fixed and then set the
> label and field widths to "fit", eg
> 
> \setupfield [MyFieldSetup] [frame, label, horizontal] [width=60mm]
>   [width=fit] [width=fit]
> 
> But that doesn't work.  Any way to do this?

A quick tip (untested)

\setbox0=\hbox{#1}% label
\dimen0=60mm
\advance\dimen0 by -\wd0 
\advende\dimen0 by <offsets> % try some 2ex  
<set width of field to \dimen0> % if needed \edef\TheWidth{\the\dimen0}
... width=\TheWidth

or something along these lines. 

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fixed width form field
  1999-10-12 17:35 ` Hans Hagen
@ 1999-10-15 13:16   ` Matthew Baker
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Baker @ 1999-10-15 13:16 UTC (permalink / raw)


On Tue, 12 Oct 1999, Hans Hagen wrote:

> A quick tip (untested)
> 
> \setbox0=\hbox{#1}% label
> \dimen0=60mm
> \advance\dimen0 by -\wd0 
> \advende\dimen0 by <offsets> % try some 2ex  
> <set width of field to \dimen0> % if needed \edef\TheWidth{\the\dimen0}
> ... width=\TheWidth

Yes, that worked.  I should be able to incorporate this into my putfield
macro now.  Thanks!

- Matt

--
Dr. Matthew Baker           matthew.baker@gmd.de
GMD - FIT.MMK               http://fit.gmd.de/hci/pages/matthew.baker.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-10-15 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-12 14:09 Fixed width form field Matthew Baker
1999-10-12 17:35 ` Hans Hagen
1999-10-15 13:16   ` Matthew Baker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).