On 09.09.2010, at 01:00, Roman Kantor wrote:
> I am trying to use different icons for different windows in my app under 
> windows - using Fl_Window::icon() method.
> However all the windows get the icon set by the first one no matter what I 
> pass to the others.
>
> Maybe to have different icons the windows must be of different xclass?

Yep, that seems plausible (although I don't really know). At least,
the icon is an argument of RegisterClass*, whatever version we use
(e.g. RegisterClassExW in FLTK 1.3).

BTW: which version are you using/talking about?

> If I understand it correctly, all fltk windows have the same class name to 
> process events with the same event function translating win32 events to fltk 
> ones.
> Is there any work-around? Any thoughts?

IMHO you don't need a workaround. It should be perfectly legal to use
more than one window class with the same WndProc function, and that's
what FLTK would do in this case.

Just set the icon and the class name before showing the first window
of each class, and this *should* work - unless I'm missing something
essential.

<http://www.fltk.org/doc-1.1/Fl_Window.html#Fl_Window.xclass>
<http://www.fltk.org/doc-1.3/classFl__Window.html#913bb4f81e4627e5b4a860ef78bca1ff>

However, the docs state: "Under Microsoft Windows this string is used as 
the name of the WNDCLASS structure, though it is not clear if this can 
have any visible effect."

You should try it and report, whether it works, so we can adjust the
docs.

Note WRT FLTK 1.3: I'm pretty sure that there is something wrong with
the class name string and the class name caching, because the string
should be converted to the proper format at the right place.
Currently[1] I would recommend to try a Windows wide char string for
the class name, e.g. L"MySpecialClass", and/or avoid any non-ASCII
characters in the string. In FLTK 1.1 the string should be encoded
in the current code page; in FLTK 1.3 it should IMHO be UTF-8 on
input and must be converted internally, but that's not yet done.
I'd guess that it should work in FLTK 1.1 though, if it works on
Windows at all (see docs above).

Good luck, and TIA for any feedback. If you can provide a simple
test case, I'd be willing to take a look at this name caching
and converting problem. OTOH, patches would be welcome (look at
the class NameList and its string handling in src/Fl_win32.cxx
around line #1394ff. in function Fl_X* Fl_X::make(Fl_Window* w).

Albrecht

-----------------------------
[1] only until the class name problem is fixed, of course. Maybe it
works with UTF-8 strings as well, but if you need the window class
externally, it might be difficult to find the right name...
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to