On 09.12.2009, at 10:07, Albrecht Schlosser wrote: > Matthias Melcher wrote: >> On 09.12.2009, at 01:08, yassine wrote: >> >>> I created custom symbols using fl_add_symbol, the draw function contain a >>> draw of a fl_PNG_Image at coordinates 0, 0. When I place the symbol on the >>> menu item, there is a blank space and the the icon is at the top of the >>> menu. I have to change the coordinates of the draw function to get the icon >>> at the correct position. >>> Is there a way to get the relative position of the menu items, note that >>> predefined symbols are correctly placed. >> >> The symbols are positioned at the base line of the font. You can use the >> standard drawing functions to get the baseline and height of the current >> font. > > Hmm, I think that this is not the expected answer to the OP's question. > His problem seems to be to draw his symbol (a png image) at the correct > position within a menu, i.e. to get the x/y coordinates of a specific > menu item.
Use fl_transform_x() and fl_transform_y() to get the screen position for the drawing. These function transform drawing coordinates into screen coordinates. If you need to know the scale, use fl_transform_dx() and fl_transform_dy(). Matthias _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

