Property of Static control (OpenInsight Specific)
At 06 DEC 2001 09:40:31AM Simon Wilmot wrote:
This is either straightforward or not possible.
Is it possible (and if so how) to set a Static control so that the text displayed is centred vertically ??
TIA
Simon
Rebus HR UK Ltd
At 06 DEC 2001 09:44AM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
Just create a static say 16 wide and 120 deep. Go into the text properties and enter say
t
e
s
t
i
n
g
and set the justification to centre. You now have what we think you are describing.
World Leaders in all things RevSoft
At 06 DEC 2001 09:56AM Oystein Reigem wrote:
Simon,
Or do you mean something like this
------------------------ | | | | | the text | | of the static | | | | | ------------------------with equal amounts of space above and beneath the text?
- Oystein -
At 06 DEC 2001 10:04AM Simon Wilmot wrote:
Thanks for the quick response.
I mean like Oystein has specified, so that on a one line text control with a height of 25, and a text/font height of 15, there would be a space of 5 above and below.
Simon
At 06 DEC 2001 10:30AM Oystein Reigem wrote:
Simon,
Two alternatives that I can think of:
(1)
GDI.
(2)
A handler that
(a) gets the font of the static
(b) gets the static's width
© perhaps calculates exactly how much of that width is available for the text. There might be some unavailable margin at each side, and you want to get the available width exactly right before the next step, in case the text wraps over several lines
(d) uses the TEXTRECT Utility to find out how many pixels high the text is when shown with the static's font and within the aforementioned width
(e) shrinks the height of the static so the text just fits vertically
(f) changes the vertical position of the static so the new, smaller version is centered relative to the old version
(g) size two extra pieces of text-less static to make up for the shrinkage.
- Oystein -
At 06 DEC 2001 11:03AM Simon Wilmot wrote:
Thanks Oystein,
I've already had one go by placing an unbordered text field on top of the first in the centre - this works OK but I wondered if there was a better method.
I think for a text field GDI is probably a bit OTT
Simon
At 06 DEC 2001 11:06AM Oystein Reigem wrote:
Simon,
Wait a minute - could there be some style you could manipulate…
- Oystein -
At 06 DEC 2001 11:10AM Simon Wilmot wrote:
Thats what I was hoping, but I can't find anything obvious …
Simon
At 06 DEC 2001 11:55AM Oystein Reigem wrote:
Simon,
If it's not possible with a static it might be possible with a different control that can show text. If you can set that other control to read-only and change its appearance so it looks like a static…
- Oystein -
At 06 DEC 2001 12:03PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
FWIW, we coded a HTML Font Dialog Box for S/Web - we used this approach when displaying the chosen font in the dialog - works really nice. You just alter the size and position of the *static* to make the text look like it's centered vertically within a given area.
World leaders in all things RevSoft
At 06 DEC 2001 12:08PM Oystein Reigem wrote:
I who thought I'd patent my idea of shrink-wrapping statics. No such luck.
![]()
- Oystein -
At 07 DEC 2001 05:07AM Colin Rule wrote:
You should be able to do this by just having a normal static control, of the height you require, and then manually modify the SIZE property so that the controls Y pos is adjusted by the amount require to offset the control vertically.
This would be something like THIS in your create event:
SIZE=.STATIC-]SIZE
SIZE=SIZE+(SIZE/2)-5
.STATIC-]SIZE=SIZE
The -5 is for a a little vertical lift for the text height and will depend on the font used.
Colin
At 07 DEC 2001 06:33AM Oystein Reigem wrote:
Colin,
My text control approach can also handle multi-line text, and text or font that is set programmatically.
- Oystein -