FLTK logo

STR #1849

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 | SVN ⇄ GIT ]

STR #1849

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:hidden subwindows receive events
Version:1.1-current
Created By:StanS
Assigned To:matt
Fix Version:1.1-current (SVN: v6030)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 wavexx
09:19 Feb 15, 2008
hidden.patch
0k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 StanS
10:06 Dec 24, 2007
Per the documentation of Fl_Widget::hide(),
 ".. An invisible widget never gets redrawn and does not get events. [..]"

However, that does not seem to be the case for sub-windows.  On
my system, the following demonstrates FL_LEAVE, FL_KEYUP, and
FL_NO_EVENT being handled.

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/names.h>
#include <iostream>

class SubWindow : public Fl_Double_Window {
public:
    SubWindow(int x, int y, int w, int h, char const* label = 0)
        : Fl_Double_Window(x, y, w, h, label)
    { end(); hide(); }

    int handle(int event)
    {
        std::cout << fl_eventnames[event] << " in hidden subwindow\n";
        return Fl_Double_Window::handle(event);
    }
};

int main()
{
    Fl_Double_Window win(300, 300, "Main");
    SubWindow sub(50, 50, 100, 100, "Sub");
    win.end();
    win.show();
    return Fl::run();
}
 
 
#2 matt
15:07 Dec 28, 2007
In Fl_Group.cxx in line 263 it says:

if (a[j]->takesevents() || event != FL_MOUSEWHEEL)...

I do not understand this line. Why would I test if a child handles events (it doesn't if it is hidden), but only for MOUSEWHEEL. I believe the line shoudl be something like:

if (a[j]->takesevents() || event == FL_MOUSEWHEEL)...

but I still cannot follow the logic. Does anybody know why MOUSEWHEEL events would be sent (or excluded for that matter)? Heck, it may even have been me who wrote this line ;-) ...
 
 
#3 wavexx
09:18 Feb 15, 2008
Yes, this line is buggy. It's probably a cut&paste bug, or the like (change 2205 mentions some cosmetic changes only).

Anyway, the line should read:

        if (a[j]->takesevents()) if (send(a[j], event)) return 1;

(testing "event" here is just a bug: FL_MOUSEWHEEL is already handled in the outer switch).

Attaching the diff against trunk.
 
 
#4 matt
09:43 Feb 20, 2008
Fixed in Subversion repository.

Thanks once again, wavexx.
 
     

Return to Bugs & Features ]

 
 

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'.