Discussion:
Changing the width of a rectangle inside an event (onbefore print)
(too old to reply)
sergiomaster
2007-10-22 09:00:33 UTC
Permalink
Hello,

i'am trying to change the with of a rectangle like this

function rectangle1_onbeforeprint(self: Travecontrol)
var
w : Double;
begin
w := 3.50;
self.width := W;
end;

but , at my (bad) surprize , the result of my width is 3 not 3.5 as
expected . i tried 3.45 , 3.65 etc ...

it seems that Self.width is taking only the fixed part of the number,
but with is an extended no ?

how can i circumvenate this ???

thanks
Fritz Franz
2007-10-22 21:13:20 UTC
Permalink
Post by sergiomaster
i'am trying to change the with of a rectangle like this
but ... the result of my width is 3 not 3.5 as expected . i tried 3.45 ,
3.65 etc ...
what is the width at desgintime? Is it 3? So maybe assigning size at runtime
(at least within this event) doesn't work.
If it is not 3 at design time try writing "self.width := 365/100;" in code.
Coding float values this way helped me in many circumstances.

Regards,

Fritz
sergiomaster
2007-10-23 06:42:45 UTC
Permalink
Post by Fritz Franz
Post by sergiomaster
i'am trying to change the with of a rectangle like this
but ... the result of my width is 3 not 3.5 as expected . i tried 3.45 ,
3.65 etc ...
what is the width at desgintime? Is it 3? So maybe assigning size at runtime
(at least within this event) doesn't work.
If it is not 3 at design time try writing "self.width := 365/100;" in code.
Coding float values this way helped me in many circumstances.
Regards,
Fritz
(No at design time it was 5)

thanks for your reply , your tip "self.width := 365/100;" just work fine

@salutations
Trevor Keegan
2007-10-23 00:16:18 UTC
Permalink
Hello SergioMaster,

In general you should always avoid just assigning heights/widths/etc as raw
numbers. Instead you should use the conversion functions e.g. XI2U, YI2U,
etc. This will allow RAVE to make the necessary conversions for you.

Regards
Trevor Keegan
sergiomaster
2007-10-23 06:40:29 UTC
Permalink
Post by Trevor Keegan
Hello SergioMaster,
In general you should always avoid just assigning heights/widths/etc as raw
numbers. Instead you should use the conversion functions e.g. XI2U, YI2U,
etc. This will allow RAVE to make the necessary conversions for you.
Regards
Trevor Keegan
Seems more complex than fritz franz's solution . i'll take time to study
your's next week end

anyway thanks for your fast replies both of you

@salutations
Trevor Keegan
2007-10-26 11:12:06 UTC
Permalink
Hi sergiomaster,

If w refers to the width. Simply change your code to something like w :=
rp.XI2U( 3.5 );

This will ensure that 3.5 is treated as 3.5 inches.
The 'rp' refers to the TBaseReport component

Regards
Trevor Keegan
Klaus Edelmann
2007-10-29 11:09:19 UTC
Permalink
Post by Trevor Keegan
Hi sergiomaster,
If w refers to the width. Simply change your code to something like w :=
rp.XI2U( 3.5 );
...
The 'rp' refers to the TBaseReport component
Hello Trevor,

OP referes to Rave scripting language. XI2U is not available there, is it?

regards,

fritz
Trevor Keegan
2007-10-30 00:05:43 UTC
Permalink
Hello Klaus,

It is available even in the scripting language.

Regards
Trevor Keegan

Loading...