> Which fltk variant?
Can you please be more specific? What does it mean fltk variant?
I use FLTK 1.1.9.

> The use of lock() and unlock() imply that this is threaded code. Is it?
>
Yep. My code is threaded. And I've compiled fltk with "--enable-threads" option
====================================================================
Here is parts of my project. I tried to keep order of function calling.
First goes header files which was used in project related to fltk.
-------------------------------------------------------------------
#include <FL/Fl.H>

#include <FL/x.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Light_Button.h>
#include <FL/Fl_Shared_Image.H>

#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Progress.H>
#include <FL/Fl_Clock.H>
#include <FL/Fl_Wizard.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Browser.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_File_Browser.H>
#include <FL/Fl_File_Input.H>

There are parts of my code below.
main function program entry point -> main.cpp
I don't understand. Do I cal for fltk thread as main thread here?
//do some initialization and then
/**=============================== START GUI ======================*/
  Fl::lock();
  std::cout << "\n => STARTING GUI\n";
  Fl::visual(FL_DOUBLE|FL_RGB8);
  mainReturn = Fl::run();
  Fl::unlock();
  /**========================= TERMINATE EXECUTION ===================*/
  if (mainReturn)
  {
    pstr = "\n*** CANNOT START GUI THREAD ***\n";
    std::cout << pstr;
    LOG.Write(pstr);
    exit(mainReturn);
  };
  exit (0);
}
-------------------------------------------------------------------
This is from cnc_gui.fl
Here it calls mngr thread

// START COMMAND MANAGER THREAD:
memset(savedPosCoords, 0, sizeof(geom_data) * 
axesNum2NameConformity::axesQuantity());
if ((msg_num = commandManager.run()) != MSG_NO_ERROR)
{
  printf("\n *** %s ***\n", msg.getString(msg_num));
  return;
}
else printf("\n COMMAND MANAGER STARTED\n");
last_coords_focus = 0;
offscreen_buf = 0;
pict_num = 0;
--------------------------------------------------------------
this is from cmd_mngr.cpp
from this thread I try to call next function

cncGUI->setRemainingTime(10);
----------------------------------------------------------------
function setRemainingTime from the class "cnc_gui" from cnc_gui.h

// SET TIME VALUE REMAINING TO THE PROCESS END
 Fl::lock();
char str[32];
unsigned long hours = (unsigned long) (RemainedTime / 3600.0);
unsigned long minutes = (unsigned long) ((RemainedTime - ((double) hours) * 
3600.0) / 60.0);
unsigned long seconds = (unsigned long) (RemainedTime - ((double) hours) * 
3600.0 - ((double) minutes) * 60.0);
sprintf(str, "%lu:%02lu:%02lu", hours, minutes, seconds);
time2end->value(str);
Fl::unlock();
Fl::flush();
-----------------------------------------------------------------------
The last function usually throws error.But I think that is because it is called 
most frequently. If I comment call for it, some other function throws 
error.I've written about it before.

If you find this explanation of my project helpful please show me my error.
Thanks a lot for the previous post.
SA
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to