Bitmap.image Coordinates

4 posts / 0 new
Last post
Rudi
Rudi's picture
Offline
Last seen: 2 months 1 week ago
Joined: 2017-03-01 09:21
Bitmap.image Coordinates

Hello,
i have a Bitmap.image inside a virtual.gadget.
If the user press LMB on the image, i want the coordinates.
Can someone tell me how I can get them?

  1. objects[OID_WINDOW] = IIntuition->NewObject(WindowClass, NULL,
  2. WA_ScreenTitle, "Editor",
  3. WA_Title, "Editor",
  4. WA_DragBar, TRUE,
  5. WA_Activate, TRUE,
  6. WA_SizeGadget, TRUE,
  7. WA_CloseGadget, TRUE,
  8. WA_IDCMP, IDCMP_INTUITICKS,
  9. WINDOW_Position, WPOS_CENTERSCREEN,
  10. WINDOW_Layout, objects[OID_ROOT_LAYOUT]= IIntuition->NewObject(LayoutClass,NULL,
  11. LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
  12. LAYOUT_SpaceOuter, TRUE,
  13. LAYOUT_AddChild, objects[OID_VIRTUAL]=IIntuition->NewObject(VirtualClass,NULL,
  14. VIRTUALA_Contents, objects[OID_LAYOUT1] = IIntuition->NewObject(LayoutClass,NULL,
  15. LAYOUT_AddImage, objects[OID_BITMAP2]= IIntuition->NewObject(BitMapClass,NULL,
  16. BITMAP_BitMap, BMCLASS_bm,
  17. BITMAP_Width, BitmapWidth,
  18. BITMAP_Height,BitmapHeight,
  19. BITMAP_Masking , TRUE,
  20. BITMAP_HasAlpha, TRUE,
  21. TAG_END),// end Bitmap
  22. TAG_END),// end layout
  23. TAG_END), // end virtuallayout

Rigo
Rigo's picture
Offline
Last seen: 1 month 3 weeks ago
Joined: 2011-01-24 21:55
Re: Bitmap.image Coordinates

Have you tried:
GetAttrs( objects[OID_ROOT_LAYOUT], GA_Left, &left, GA+Top, &top, TAG_DONE );

As the bitmap.image is the only thing in the layout, the coordinates of that gadget should be almost equal to the bitmap. You may have to adjust the left and top values for any layout spacing/borders etc.

Simon

Rudi
Rudi's picture
Offline
Last seen: 2 months 1 week ago
Joined: 2017-03-01 09:21
Re: Bitmap.image Coordinates

Hello Simon,
there is more in the layout, not just the bitmap.image.
And the bitmap is larger then the virtual.gadget.
The first Problem I have is how to detect if the lmb was pressed inside the bitmap.image or virtual.gadget.

Rudi
Rudi's picture
Offline
Last seen: 2 months 1 week ago
Joined: 2017-03-01 09:21
Re: Bitmap.image Coordinates

Hello,
I changend the bitmap.image to a normal Button with the GA_Image set to the bitmap.image.
I think with this solutiom I should get all Info I need.

Log in or register to post comments