Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with Character in Visual Basic 5

0 views
Skip to first unread message

David Hearn

unread,
Jul 20, 1998, 3:00:00 AM7/20/98
to
I have an app that I am using MS Agent in and I want to have a character
move to a certain control when I click on it. Example: Click on a button and
have the Genie fly down next to it so I can have him point at it. I know how
to use the MoveTo method, but I am having trouble telling him what
coordinates the button is sitting at on my form. Anyone have any experience
with this and can give me some help with the code that I need to use to
determine the coordinates?

Thanks in advance!

David Hearn
dhe...@mindspring.com


Stephen Travis

unread,
Jul 21, 1998, 3:00:00 AM7/21/98
to
It's not as easy as it appears. Start Here...
http://www.argolink.com/agent/devcorner/dev/screen-control.html

David Hearn wrote in message <6ovha3$cb4$1...@camel29.mindspring.com>...

Dean Farrell

unread,
Jul 21, 1998, 3:00:00 AM7/21/98
to
The trick is you have to convert pixels to twips and take into account the
offset of your form
from 0,0 on the screen. You also need to take into the account the size of
the agent, typically 128x128 and adjust your offset.

To convert twips use the functions twipstopixelsx and twipstopixelsy.

So if a button is at 1000 top, and 7000 left twips. (scalemode of form)

Let's say twips to pixels is 10. (never).

And let's say the form is at 100 top, 100 left twips)

Form is at 10 top and 10 left pixels. (ie 100/10)
Button is at 100 top and 90 left pixels.
Button on screen is at 110 top and 710 left.

So you want to move your agent to:
Top(Y) of (100 - (128/2)
Left(X) of (710 - 128 - 5) the extra 5 is to make sure your
agent doesn't actually touch (looks better)

Hope this helps.

Good Luck,


Dean

David Hearn

unread,
Jul 21, 1998, 3:00:00 AM7/21/98
to

Stephen,

Thanks for the link. Looks like it has some good information on it I can
use.

David Hearn
dhe...@mindspring.com


David Hearn

unread,
Jul 21, 1998, 3:00:00 AM7/21/98
to

Dean,

Thanks for the reply and the info. I will give it a try.

David Hearn
dhe...@mindspring.com


David Hearn

unread,
Jul 21, 1998, 3:00:00 AM7/21/98
to

Dean,

I seem to be having some trouble with this still. Could you be so kind
as to send me an example of some code to perform this task.

Thanks,
David Hearn
dhe...@mindspring.com


0 new messages