Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Pascal and Integer and Double
Fri, Sep 21 2012 3:36 PMPermanent Link

Peter

Hello,

i'm not very familiar to Pascal, so i had a little trouble to center a
panel on the desktop. My first attempt was:

Panel1.Top := (Application.Desktop.Height - Panel1.Height) / 2;

But EWB told me:

[Error] unMain.wbs (51,19): Expected integer but instead found
(Application.Desktop.Height - Panel1.Height) / 2

So i try around until i have this line:

Panel1.Top := StrToInt(DoubleToStr((Application.Desktop.Height -
Panel1.Height) / 2));


But i bet, there is a better way to do this. I'm right?


Thanks in advance & Greetings ... Peter
Fri, Sep 21 2012 4:29 PMPermanent Link

Eric Schwarz

Avatar

In Pascal, A / B gives a real result, you want A div B
===================================================

=?ISO-8859-15?Q?Peter_T=FCbben?= wrote:

Hello,

i'm not very familiar to Pascal, so i had a little trouble to center a
panel on the desktop. My first attempt was:

Panel1.Top := (Application.Desktop.Height - Panel1.Height) / 2;

But EWB told me:

[Error] unMain.wbs (51,19): Expected integer but instead found
(Application.Desktop.Height - Panel1.Height) / 2

So i try around until i have this line:

Panel1.Top := StrToInt(DoubleToStr((Application.Desktop.Height -
Panel1.Height) / 2));


But i bet, there is a better way to do this. I'm right?


Thanks in advance & Greetings ... Peter
Fri, Sep 21 2012 5:25 PMPermanent Link

Peter

Hello Eric,

> In Pascal, A / B gives a real result, you want A div B

Cool. Thanks a lot! Smile

Greetings ... Peter
Image