STR #1187

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

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:3 - Applies to all machines and operating systems
Summary:fluid 1.1.7 Write Code drops 'public:' qualifier in class declaration
Created By:duncan.gibson
Assigned To:matt
Fix Version:1.1-current (SVN: v5083)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Name/Time/Date Filename/Size top right image
#1 duncan.gibson
10:11 Feb 27, 2006
bottom left image   bottom right image

Trouble Report Comments:

Name/Time/Date Text top right image
#1 duncan.gibson
10:11 Feb 27, 2006
Some non-obvious combination of factors in the example below causes
fluid's Write Code to drop the 'public:' qualifier from the class
declaration in the *.h file, but fluid -c works normally.

A pain in the bum, but easy to work round with sed in a makefile.

# data file for the Fltk User Interface Designer (fluid)
version 1.0107
header_name {.h}
code_name {.cxx}
class MyClass {open selected
} {
  Function {CallbackAction(Fl_Widget* widget, void* data)} {open return_type {virtual void}
  } {
    code {// override this in a derived class} {}

widget_class MyWidgetClass {open
  xywh {5 52 100 100} type Double
  class Fl_Group visible
} {}
#2 fabien
00:51 Mar 23, 2006
Hi Duncan,
I just check it with the 1.1 svn cyurrent branch and it works for me i obtain after selecting the 'Write Code' menu:

class MyClass {
  virtual void CallbackAction(Fl_Widget* widget, void* data);
#include <FL/Fl_Group.H>

class MyWidgetClass : public Fl_Group {
  MyWidgetClass(int X, int Y, int W, int H, const char *L = 0);

So for me there's no  problem (at least now) please confirm it's solved and close the STR.
#3 duncan.gibson
02:30 Mar 23, 2006
It's an intermittent problem, and one that I had difficulty in
reproducing in a short example.

I've just reloaded str.fl in fluid-1.1.7 and if I Write Code
immediately then I do get the correct 'public' declaration.

If you start with an empty fluid project and build up the same
code, then Write Code will trigger a Save As and will then work.

However, if I quit and start again, remove the final 's' from the
// override this in a derived class
line, and then remove the trailing 's' to give MyWidgetClas and
then Write Code, the 'public' keyword is missing from str.h

This has just 'worked' ie failed for me, but you might have to
play around with it to get it to fail. I have the feeling that
it is creating and editing the Widget Class that triggers this
especially if you run multiple edit and Write Code cycles but
you don't Save in between.
#4 fabien
08:37 Apr 04, 2006
removed myself from this bug affectation , as this is 1.1.x bug i didn't found / solved and i am more specialized/focused in 2.0.x.
Sorry for not having solved that one, i'm sure someone from the 1.1.x original team will fix it ;)
#5 matt
15:03 Apr 27, 2006
Exactly which 'public' in the .H file is dropped? There are three possible 'public' that could be, but which one is it? I don't want to chase shadows, especially if I can't reproduce the issue ;-)  
#6 duncan.gibson
00:43 Apr 28, 2006
In the str.h file, the MyClass declaration looks like:

class MyClass {
  virtual void CallbackAction(Fl_Widget* widget, void* data);

The 'public:' line after the 'class MyClass {' line is missing,
so the [now private] CallbackAction method cannot be called from
outside the class.

As I said, the problem is intermittent, but the previous instructions
appear to reproduce the problem sufficiently often on this test file
on my machine, that I hope you can reproduce it too.
#7 duncan.gibson
04:07 Apr 30, 2006
I've been running the debugger on fltk-1.1.x-r5041 to try to understand this. I think the problem arises with the logic in the write_public() function in Fl_Function.type.cxx. current_class is reset to parent_class in Fl_Class_Type::write_code2() but current_widget_class is never reset.

current_widget_class is set in Fl_Widget_Class_Type::write_code1(). Is there a missing reset to parent_class in Fl_Widget_Class_Type::write_code2() ?

I haven't traced all of the logic yet, so I'm not sure.
#8 duncan.gibson
11:14 Apr 30, 2006
Sorry, I wasn't very clear above...

I've looked a bit further. I don't have the big picture for the code,
and why things are done as they are, but it seems to me that either
there is some missing logic in Fl_Function_Type.cxx/write_public(),
or Fl_Window_Type.cxx/current_widget_class needs to be reset. Or both.

What I also don't understand is why the inheritance in Fl_Type.h is
private: i.e. class Fl_Widget_Class_Type : private Fl_Window_Type {
as this suggests that current_widget_class shouldn't be reset to

I'm afraid I probably won't have access to any replies until 10th May.
#9 matt
15:41 Apr 30, 2006
No, I got you. I'll fix it when I come home. Thanks for finding that bug. I was close behind you, looking at the same function as the culprit.

#10 matt
06:51 May 05, 2006
Fixed in Subversion repository.

OP, please verify the result. It seems to work well here.
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 ''.