FLTK logo

[fltk/fltk] test/icon demo could use some improvements (Issue #297)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] test/icon demo could use some improvements (Issue #297) erco77 Nov 26, 2021  
 

I found the test/icon demo a bit confusing.

I've never actually used it and couldn't really tell what it did, even from the code comments; Is this for testing widget icons or the window manager icon? When it opens it just says "Colour" and the choice is "red" but nothing is red, and what's it the color of? It's only when you change the choice to something else it properly updates the icon, which is weird. And shouldn't there be a way to set 'no icon'?

Here's a few improvements that come to mind:

  1. Change the choice label from just "Colour" to "Window icon:"
  2. Have "none" as the default/initial choice, and tweak the callback to allow for the 'none' choice to invoke win->icon(0);, which according to the docs is a valid way to 'reset' the icon.. a good thing to test to make sure an icon can be assigned, then unassigned.
  3. The class instance Fl_RGB_Image icon goes out of scope on returning from the callback. It is not clear in the docs for Fl_Window::icon(Fl_RGB_Image)that the buffer is no longer needed, so not sure if this is a bug or correct behavior. (a) Docs for icon() should be improved me thinks, to indicate if the buffer needs to remain allocated or not, and if it is OK, (b) adding a comment on thewin->icon(&icon);line that says something like// once assigned, 'icon' can go out of scope` just to make it clear.
  4. Perhaps a tooltip for the choice that elaborates on what this program does; affects the window manager's title bar and toolbar icon.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.