Home > Archive > Smalltalk > November 2005 > How To: (Objectstudio) Get left and top of an item on a form
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How To: (Objectstudio) Get left and top of an item on a form
|
|
|
| Yes it seems like a simpel question but read on....
I have an Objectstudio application and I need to read the left and top
off the items on a form.
.... still simpel I know, keep reading...
I need those values so I can make the same form representation in
another programming language, lets say Delphi 2005.
Now the problem is this:
The values I get for top and left are way to big therefore I cannot use
them without doing some conversion first to their real left and top (or
x and y). So the real question is how to do this in Objectstudio before
I send them to the other (Delphi) application.
I have tried using the items Rectangle asPixelRect (and others) but
this is still not accurate enough (in Delphi the tops between the items
get to small so they overlap). I also noticed that while it seems like
2 edit fields (one under the other) are shown as aligned to the same
left position when I inspect their rectangle the lefts differ about 3
points (one is left 144 the other is left 141)! On screen they are
aligned correctly.
Any help would be very welcome,
TNX.
| |
|
| I also noticed that while it seems like 2 edit fields (one under the
other) are shown as aligned to the same left position when I inspect
their rectangle the lefts differ about 3
points (one is left 144 the other is left 141)! On screen they are
aligned correctly.
(NOTE: I am talking about Objectstudio here not Delphi.)
| |
| Christof Handirk 2005-11-07, 10:03 pm |
| Hi,
the unit of measuring positions in ObjectStudio is that small (tenth of
milimeter), that a difference of 3 might not even mean one pixel and
therefore the two items seem to be (or are) aligned.
Anyway, I don't understand, what you are looking for. Is it the items's
absolute top left position on the screen or the items top left position
within the form in pixel rather than ObjectStudio unit?
For the latter use
formItem normalizedRect asPixelRect origin.
For the former, I have written a much more complex FormItem method. I
can post, if needed.
Kind regards
Christof
BTW: There is a newsgroup for ObjectStudio only
"comp.lang.smalltalk.objectstudio"
GD schrieb:
> I also noticed that while it seems like 2 edit fields (one under the
> other) are shown as aligned to the same left position when I inspect
> their rectangle the lefts differ about 3
> points (one is left 144 the other is left 141)! On screen they are
> aligned correctly.
>
> (NOTE: I am talking about Objectstudio here not Delphi.)
>
| |
|
| This one seems to do it for me: formItem normalizedRect asPixelRect
origin
TNX !
| |
| Christof Handirk 2005-11-08, 3:58 am |
| Hi,
if you want to be sure, that the items are aligned and do have the same
coordinates, use in the designer menu
Form>Grid and snap... and check the "Snap to grid" check box
Regards
Christof
GD schrieb:
> I also noticed that while it seems like 2 edit fields (one under the
> other) are shown as aligned to the same left position when I inspect
> their rectangle the lefts differ about 3
> points (one is left 144 the other is left 141)! On screen they are
> aligned correctly.
>
> (NOTE: I am talking about Objectstudio here not Delphi.)
>
|
|
|
|
|