Subject: [SWIPL] Displaying icons with XPCE - Windows platform

From: Fabien Todescato <[email-masked]>
Date: Thu, 29 Nov 2001 16:52:45 +0100

Dear XPCErs,

With XPCE 5.1.9 running under WNT4.0, I have the following problem when
trying to load and display icons held in '.ico' files :

00 ?- new(P,picture).
01
02 P = @789847/picture
03
04 Yes
05 ?- send($P,open).
06
07 Yes
08 ?- new(B,bitmap('X:/00222.ico')).
09
10 B = @805430/bitmap
11
12 Yes
13 ?- send($P,display,$B,point(48,48)).
14
15 Yes
16 ?- [PCE fatal: x:/00222.ico: Xopen failed on @display/display
17         in:     <No exception goal>
18 ]
19         <No goal>
20 Host stack:
21       [1] '$toplevel'
22 % Execution Aborted
23 ?- send($B,cursor(fleur)).
24
25 Yes
26 ?- send($B,recogniser,move_gesture(left)).
27
28 Yes

As you can see, I get an exception when trying to display the bitmap in the
picture. The bitmap is not displayed in the windows at first, but appears as
expected when the window undergoes a refresh, when resized, for example.

The bitmaps behaves afterwards in the expected manner, a cursor can be
specified on it, a recogniser can be attached to it, and so on...

As of now, I guess wrapping the icon display within an appropriate exception
handler is a possible workaround, but this does not solve the problem of the
icon not being immediately displayed in the picture. Another workaround is
to convert the .ico into a .bmp that will be correctly loaded, but then the
transparency mask of the icon is lost.

Has anyone else come across that problem already, and are more satisfying
workarounds known ?

Thanks a lot, Fabien TODESCATO