Forum > Other

change title bar icon in fpgui program?

<< < (2/3) > >>

benohb:


--- Quote ---Works in Windows but not Linux but I think that this is not unique to fpgui
--- End quote ---


Yes ..in linux it is use a fixed Icon (array of pixel)
..../fpgui/src/corelib/x11/fpg_x11.pas  **line 48
IconBitmapBits: packed array[1..32] of Byte = (
    $00, $00, $78, $07, $08, $00, $00, $00, $08, $07, $08, $01,
    $08, $01, $00, $00, $00, $00, $98, $74, $a4, $24, $84, $24,
    $b4, $24, $a4, $24, $18, $73, $00, $00); 

dieselnutjob:

--- Quote from: benohb on August 02, 2014, 03:47:58 pm ---

--- Quote ---Works in Windows but not Linux but I think that this is not unique to fpgui
--- End quote ---


Yes ..in linux it is use a fixed Icon (array of pixel)
..../fpgui/src/corelib/x11/fpg_x11.pas  **line 48
IconBitmapBits: packed array[1..32] of Byte = (
    $00, $00, $78, $07, $08, $00, $00, $00, $08, $07, $08, $01,
    $08, $01, $00, $00, $00, $00, $98, $74, $a4, $24, $84, $24,
    $b4, $24, $a4, $24, $18, $73, $00, $00); 

--- End quote ---

I got this working in Linux
if you change the code to this

IconBitmapBits: packed array[1..32] of Byte = (
%00000000,%00000000,
%01111000,%00000111,
%00001000,%00001001,
%00111000,%00001001,
%00001000,%00000111,
%00001000,%00000001,
%00001000,%00000001,
%00000000,%00000000,
%00000000,%00000000,
%10011000,%01110100,
%10100100,%00100100,
%10000100,%00100100,
%10110100,%00100100,
%10100100,%00100100,
%00011000,%01110011,
%00000000,%00000000);

you can actually see the icon that you are getting but the way it is drawn has an opposite endianness or something.
so on the left you can see the "F" but back to front on the right the "P" but back to front.

engkin:
You can use words instead of bytes:

--- Code: ---IconBitmapBitsW: packed array[1..16] of Word = (
%0000000000000000,
%0000011101111000,
%0000100100001000,
%0000100100111000,
%0000011100001000,
%0000000100001000,
%0000000100001000,
%0000000000000000,
%0000000000000000,
%0111010010011000,
%0010010010100100,
%0010010010000100,
%0010010010110100,
%0010010010100100,
%0111001100011000,
%0000000000000000);

--- End code ---

and if you insist on using bytes:

--- Code: ---IconBitmapBits: packed array[1..32] of Byte absolute IconBitmapBitsW;

--- End code ---

and if you care, you can reverse the bits using any of the methods mentioned here.

Graeme:

--- Quote from: dieselnutjob on April 13, 2014, 08:34:10 pm ---Is there a way to change the icon in the title bar of a program written using fpgui?

--- End quote ---
fpGUI doesn't currently have support for setting individual forms to have different window title icons. In Windows you can set the application icon using a standard *.rc file, which then becomes the default icon for all windows. In Linux it is hard-coded to a 2-bit (Black & White only) fpGUI logo.

The ability to set individual form icons has been on my todo list for a long time. I've got some time now, and will quickly knock out a solution. I'll post here as soon as it is done.

dieselnutjob:

--- Quote from: engkin on August 10, 2014, 05:18:56 am ---You can use words instead of bytes:

--- End quote ---

Yes your solution is better than mine.


--- Quote from: engkin on August 10, 2014, 05:18:56 am ---and if you care, you can reverse the bits using any of the methods mentioned here.

--- End quote ---

I just wanted other people to be able to figure out how to do without having to reverse engineer it like I did.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version