PDA

View Full Version : OnClick how ?



aleksander_tenev
30-10-2006, 01:58 PM
hi , i draw one picture on the screen


ImageList.Items[0].Draw(DXDraw1.Surface,255,50,0);
DXDraw1.Flip;

But I can't find OnClick property.

savage
30-10-2006, 01:59 PM
the OnClick property for what?

aleksander_tenev
30-10-2006, 02:06 PM
For the picture that i draw .

savage
30-10-2006, 02:27 PM
ImageLists and ImageList items DO NOT, have an OnClick event.
TImage or TPaintBox have OnClick events.

jasonf
30-10-2006, 05:27 PM
You need to use a combination of
Form.DXDraw1MouseMove and ( Form.DXDraw1MouseDown or Form.DXDraw1MouseUp )

test your object to see if they are at the same point as the mouse and perform the relevant action.


I do something like this in my Demo Game Guns

http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=38

I create a sprite which is the mouse pointer.
On the MouseMove I set my Cursor sprite position
On the MouseUp I see if the my menu options to see if they collided with the cursor in the DoCollision phase and depending on the menu options selected, I perform some action.

This is not the only or by any means the best way to do it, but it's one way.

In my current game I bind the address of a procedure to the object and when the Click is made, if it is assigned, the object calls the procedure itself.