[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XForms] How can I assign a pixmap icon to a form?
From: |
Jens Thoms Toerring |
Subject: |
Re: [XForms] How can I assign a pixmap icon to a form? |
Date: |
Sun, 30 Nov 2014 18:52:36 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi,
On Sun, Nov 30, 2014 at 07:18:03AM -0600, Mr. Christian Strubel wrote:
> I have been reading the documentation and trying the examples.
> However, I am having trouble assigning a X Pixmap icon to a form.
>
> Could someone please provide a hyperlink that covers how to do this
> or a code snippet with an example?
Serge already wrote how to add a pixmap object to a form.
In case your question was more about how to assign a pixmap
to a form to be used when the form's window is iconified
here's a short example program:
-------8<-----------------------------------
#include <forms.h>
int
main( int argc,
char * argv[ ] )
{
fl_initialize( &argc, argv, 0, 0, 0 );
// Create a form
FL_FORM * form = fl_bgn_form( FL_NO_BOX, 320, 250 );
fl_add_box( FL_FLAT_BOX, 0, 0, 320, 250, "" );
fl_end_form( );
// Load pixmap from file and set it as the icon for the form
Pixmap mask;
Pixmap pm = fl_read_pixmapfile( fl_root, "xterm.xpm", &w, &h,
NULL, NULL, NULL, 0 );
fl_set_form_icon( form, pm, None );
// Show the form and run event loop
fl_show_form( form, FL_PLACE_CENTERFREE, FL_FULLBORDER, "Test" );
fl_do_forms( );
fl_finish( );
return 0;
}
-------8<-----------------------------------
Note that it seems to be necessary to use 'fl_root' as the window
argument when loading the pixmap from a file if that pixmap is to
be used for the iconified window.
Of course, it also shoule work with a pixmap embedded into the
source code - in that case you have to use the function
l_create_from_pixmapdata() instead of fl_read_pixmapfile() to
create the pixmap/
As always with settings for windows, all this requires the
cooperation of the window manager - with a window manager that
doesn't onour the hint fl_set_form_icon() has no effect...
Best regards, Jens
--
\ Jens Thoms Toerring ________ address@hidden
\_______________________________ http://toerring.de