STR #1421

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 #1421

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:Documentation
Summary:Fl::box_d[xywh]() functions need more info and an example
Version:1.1-current
Created By:greg.ercolano
Assigned To:matt
Fix Version:1.1-current (SVN: v5424)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text top right image
 
#1 greg.ercolano
17:22 Sep 05, 2006
I'd like to suggest the docs for Fl::box_dx() and friends be augmented to include some extra information, specifically:

   a) Indicate the return values are all positive
   b) Show example values returned by the functions
   c) Show example of how to compute the inner area of a box

I'd like to suggest something like:

---- snip

int box_dx(Fl_Boxtype); // positive X offset
int box_dy(Fl_Boxtype); // positive Y offset
int box_dw(Fl_Boxtype); // positive width offset
int box_dh(Fl_Boxtype); // positive height offset

  These functions return the offset values necessary for a given
  boxtype, useful for computing the area inside a box's borders, to
  prevent overdrawing the borders.

  For instance, an FL_DOWN_BOX might have a border width of 2, so the
  return values for the above functions will be 2,2,4,4 respectively.

  For instance, in the case of a boxtype like FL_DOWN_BOX where the
  border width might be 2 pixels all around, the above functions would
  return 2,2,4,4 respectively.

  An example to compute the area inside a widget's box():

      int X = yourwidget->x() + Fl::box_dx(yourwidget->box());
      int Y = yourwidget->y() + Fl::box_dy(yourwidget->box());
      int W = yourwidget->w() - Fl::box_dw(yourwidget->box());
      int H = yourwidget->h() - Fl::box_dh(yourwidget->box());

  These functions are mainly useful in the draw() code for deriving
  custom widgets, where one wants to avoid drawing over the widget's
  own border box().

---- snip

I think this will help folks understand how to use these functions,
as I don't think it's immediately obvious, without looking at FLTK's
own source code.
 
 
#2 matt
00:29 Sep 06, 2006
Fixed in Subversion repository.

Thanks for the contribution.
 
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 'erco@seriss.com'.