menus and images with transparent background



Hi

I'm experiencing a problem with menus. If I use an image with transparent background to be displayed beside a text, the image is not shown correct (very ugly). It doesn't matter, if you use a popup or window menu.

If the mouse moves over the icon, the right layout is then drawn correct.

This is an example what demonstrates the problem, you have to change the path to an icon with transparent background.

#drawing problems with images with transparent background
package require Img 1.3
image create photo icon1 -file c:/windows/hp.ico;       #change to existing icon
pack [button .b -text "Click Right Mouse Button Here"]
bind .b <3> "postmenu %X %Y"
set var1 on
proc postmenu {x y} {
    catch {destroy .m}
    menu .m -tearoff 0
    .m add command -label command
    for {set i 0} {$i < 10} {incr i} {
	set ::var$i on
	.m add checkbutton -label "check $i" -onvalue on -offvalue off -variable ::var$i
	.m add command -label "command $i" -image icon1 -compound left
    }
    ::tk_popup .m $x $y
}

thanks in advance
khamis

--
Try Code-Navigator on http://www.codenav.com
a source code navigating, analysis and developing tool.
It supports following languages:
    * C/C++
    * Java
    * .NET (including CSharp, VB.Net and other .NET components)
    * Classic Visual Basic
    * PHP, HTML, XML, ASP, CSS
    * Tcl/Tk,
    * Perl
    * Python
    * SQL,
    * m4 Preprocessor
    * Cobol
.