STR #1678

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 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 1.1 ]

STR #1678

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:fl_down() and fl_frame() functions incorrect
Created By:d.zimmer
Assigned To:matt
Fix Version:1.1-current (SVN: v5834)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files

Trouble Report Comments:

Name/Time/Date Text top right image
#1 d.zimmer
21:15 May 14, 2007
fl_down(FL_NO_BOX) produces FL_FLAT_BOX, when it should return FL_NO_BOX

fl_frame(), although apparently unused by the library, seems to be completely wrong.

see following demo:

void main(void)
# define old_fl_down(b)  (b|1)
# define old_fl_frame(b) (b|2)

# define new_fl_down(b)  ((b<FL_UP_BOX)?b:(b|1))
# define new_fl_frame(b) ((b%4<2)?b:(b+2))
# define new_fl_box(b)   ((b<FL_UP_BOX||b%4>1)?b:(b-2))

  char *names[] = {
  int i;

  for(i=FL_NO_BOX; i<=FL_BORDER_BOX; i++)
    printf("original for %s, down=%s\n", names[i], names[old_fl_down(i)]);
    printf(" revised for %s, down=%s\n", names[i], names[new_fl_down(i)]);

  for(i=FL_NO_BOX; i<=FL_BORDER_BOX; i++)
    printf("original for %s, frame=%s\n", names[i], names[old_fl_frame(i)]);
    printf(" revised for %s, frame=%s\n", names[i], names[new_fl_frame(i)]);

  for(i=FL_NO_BOX; i<=FL_BORDER_BOX; i++)
    printf("test for %s, box=%s\n", names[i], names[new_fl_box(i)]);

Suggested fixes to FL/Enumerations.H:

inline Fl_Boxtype fl_down(Fl_Boxtype b) {return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));}
inline Fl_Boxtype fl_frame(Fl_Boxtype b) {return (Fl_Boxtype)((b%4<2)?b:(b+2));}

addition, if desired:

inline Fl_Boxtype fl_box(Fl_Boxtype b) {return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));}

It also occurs to me that a caveat should be added to the documentation when defining new box types... that at least both up/down styles should be defined, since Fl_Button will automatically call fl_down().

#2 matt
01:33 May 16, 2007
Fixed in Subversion repository.

Thanks for these good suggestions. I hope that my additions in the documentation are understandable. Maybe some native speaker finds the time to "de-germanfy" my blurbs.
bottom left image   bottom right image

Return to Bugs & Features ]


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