yassine wrote:
> Hi,
>  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.

For the positioning problem, please see my other reply.

> Example code:
> static void draw_png_icon(Fl_Color c) {
>       fl_color(c);
>       static Fl_PNG_Image *i = new Fl_PNG_Image("icon.png");

Note: you wrote "Example code", and so I assume that this is not
your real code, but if it is: the above statement would create
a new image (and load it from disk) for each call to your draw
function. This should read:

   static Fl_PNG_Image *i = 0;
   if (!i) i = new Fl_PNG_Image("icon.png");

But I think that you knew this.

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to