[fltk.bugs] [MOD] STR #2933: fltk-1.3.x-r9831 and Cygwin

2013-03-02 Thread w . szukalski

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2933
Version: 1.3-current


../lib/libfltk.a(fl_dnd.o):fl_dnd.cxx:(.text$_ZN12FLDropSource14QueryInterfaceERK5_GUIDPPv+0x18):
undefined reference to `_IID_IUnknown'

../lib/libfltk.a(fl_dnd.o):fl_dnd.cxx:(.text$_ZN12FLDropSource14QueryInterfaceERK5_GUIDPPv+0x53):
undefined reference to `_IID_IDropSource'

/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:
../lib/libfltk.a(fl_dnd.o): bad reloc address 0x53 in section
`.text$_ZN12FLDropSource14QueryInterfaceERK5_GUIDPPv'

collect2: ld gab 1 als Ende-Status zurück
make[1]: *** [cygfltknox-1.3.dll] Error 1
make: *** [all] Error 1


CYGWIN_NT-6.1-WOW64 szukw000-PC 1.7.17(0.262/5/3) 2012-10-19 14:39 i686
Cygwin

winfried


Link: http://www.fltk.org/str.php?L2933
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [MOD] STR #2933: fltk-1.3.x-r9831 and Cygwin

2013-03-02 Thread Albrecht Schlosser

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2933
Version: 1.3-current


This could be an autoconf/configure problem, or maybe your Cygwin version
is not up-to-date. There has been an update for binutils lately, for
instance.

Basically, I have the same Cygwin version, and I made sure that mine is
up-to-date:

uname -a
CYGWIN_NT-6.1-WOW64 as-w7 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin

I tried different ./configure command lines, and all variants worked for
me (after running commands like the following). Please try this:

make distclean
rm -rf autom4te.cache/
autoconf -f
./configure --enable-cygwin --enable-shared --disable-x11

The last line (./configure...) seems to be what you did, but I can only
guess. If this doesn't work for you, please post your configure line and
results, and show your error messages with a little more context (at least
the last few successful compile commands before the error).

BTW: your output looks strange, since you seem to compile for cygwin, but
you also seem to have disabled X11 (because I see cygfltknox-1.3.dll in
your error message) - however, this ought to work as well, and the command
line given above works for me.


Link: http://www.fltk.org/str.php?L2933
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.general] Which Fl_Menu_Bar submenu is current?

2013-03-02 Thread Albrecht Schlosser
On 02.03.2013 00:50, Howard Rubin wrote:

 How can I find out which dropdown menu of an Fl_Menu_Bar is currently
 dropped down (if any)?

 I need to know this in an add_timeout()/repeat_timeout() timer.

I don't know if there is a way to do it, and I'm afraid there is no
official/documented way to do this. Also, please take care not to
open or modify windows while a menu is open. This can yield unwanted
effects, since the open menu window does a grab(), so that mouse
events can be captured. This can result in the program appearing to
hang. Although this has been fixed at least partially, there can still
be some bad effects. See http://www.fltk.org/str.php?L1986

That said, I'd try if mvalue() is of some help for you. It returns
the last menu item that was picked(), and I assume this is or can
be the (parent ?) item that has been clicked to open the currently
open menu item/window. However, I'm not at all sure about this, and
you'd have to check if this is also usable if only the top level
menu item has been opened, and also if this is really reset when
the menu is dismissed - I don't know, but this is the best help I
can give.

Another way could be to use a callback that will be called when
a menu is selected, but again I'm not sure if this will help.
You'd probably have to track the open menu(s) yourself, and I also
don't know if you'd get a callback when the menu gets closed.

HTH

Albrecht

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] Which Fl_Menu_Bar submenu is current?

2013-03-02 Thread Greg Ercolano
On 03/01/13 15:50, Howard Rubin wrote:
 Hello,
 
 How can I find out which dropdown menu of an Fl_Menu_Bar is currently 
 dropped down (if any)?

Not too familiar with this part of the code,
but looking at the source,
I don't think the API provides a way to do this.

To provide this functionality, I think Fl_Menu would have to be
modified to give you access to the state of shown() method
for the 'menuwindow' class, and walk the 'menustate' array,
both of which are classes internal to Fl_Menu.

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] Question about Fl_Input

2013-03-02 Thread edgar

So for a Fl_Input you can set the when() as FL_WHEN_ENTER_KEY, then if you hit 
the enter key, the callback for the input widget should run.

I tried that in a test program and it works.  Thanks!

Can you clarify; I'm not clear what you are asking here, can you outline what 
you are trying to achieve, then we can suggest some ways you might implement 
that.

I am starting with a simple program to show a whole note on a staff with a 
treble clef. The user is asked to enter the note name. The program should let 
the user know if their input was correct and display a running score in the 
window.

Here is the basic algorithm:

Display window with the following:

  Instruction header - prompts user to enter note name.
  staff and clef - (staff is drawn. clef and note are .png)

  Loop {
  note is shown on the staff - chosen randomly from a bank of locations.
  User enters note name
  Program checks user response, tabulates a score and prints a running  score 
to the window
  }

  User selects a quit button which destroys all dynamically allocated widgets.

Here is the code I have so far.  It compiles and runs with my png files, but I 
don't know how to:
1.  Get the user's input to the window instead of the console.
I think I can send it to an output box, but I'd like to send
it to the window via an invisible box  - sort of like the header.
2.  Loop the sequence. I would also like to keep the code which checks the 
answers separate from the code that implements the GUI.

#include FL/Fl.H
#include FL/Fl_Window.H
#include FL/Fl_Button.H
#include FL/Fl_Return_Button.H
#include FL/Fl_Input.H
#include FL/Fl_Box.H
#include FL/fl_draw.H
#include FL/Fl_Shared_Image.H
#include FL/Fl_PNG_Image.H
#include iostream
using namespace std;

// SIMPLE WIDGET THAT DRAWS A LINE
class DrawLINE : public Fl_Widget {
public:
DrawLINE(int X, int Y, int W, int H, const char*L=0) : Fl_Widget(X,Y,W,H,L) 
{
}
void draw() {
// DRAW BLACK LINE
fl_color(FL_BLACK);
fl_line_style(FL_SOLID, 2);
int x1 = x(), y1 = y(), x2 = w(), y2 = h();
fl_line(x1, y1, x2, y2);
}// modified from G. Ercolano's cheatsheet (Draw an X)
}; // When this is resized it gets funky so I think I don't have it
   // quite right...

class SimpleWindow : public Fl_Window{

   public:
  SimpleWindow(int w, int h, const char* title );
  ~SimpleWindow();
  Fl_Input* inp;
  Fl_Return_Button* entr;
  Fl_Button* quit;
  Fl_Box* header;
  Fl_Box* noteBox;
  Fl_Box* clefBox;
  Fl_Box* comment;

  const char* letters;  // user response

  Fl_PNG_Image* note;
  Fl_PNG_Image* clef;

  // DrawLINE pointers for drawing the staff
  DrawLINE* line1;
  DrawLINE* line2;
  DrawLINE* line3;
  DrawLINE* line4;
  DrawLINE* line5;
  DrawLINE* vert1;
  DrawLINE* vert2;
  DrawLINE* vert3;

   private:

  static void cb_getInfo(Fl_Widget*, void*);
  inline void cb_getInfo_i();

  static void cb_quit(Fl_Widget*, void*);
  inline void cb_quit_i();
};

//

int main (){

   SimpleWindow win(400,400,Treble Clef Note Identification);
   return Fl::run(); // I modified the window below from a beginner //fltk 
tutorial.
   // The problem I see is that implementation of the SimpleWindow looks
   // like function main.  I really don't want to attempt loops inside
   // a class implementation
}

//--From what I understand it is better to have children of a window
// dynamically allocated so all the info can be passed via a pointer
// and all the children are destroyed when the parent is destroyed.
// Is this a correct assumption and good programming practice?

SimpleWindow::SimpleWindow(int w, int h, const char* 
title):Fl_Window(w,h,title){

   begin();

  // Draw header
  header = new Fl_Box(100, 20, 200, 30, Type the note name in the 
box\nbelow and hit enter.);

  // Draw Staff
  line1 = new DrawLINE(100, 100, 300, 100);
  line2 = new DrawLINE(100, 110, 300, 110);
  line3 = new DrawLINE(100, 120, 300, 120);
  line4 = new DrawLINE(100, 130, 300, 130);
  line5 = new DrawLINE(100, 140, 300, 140);
  vert1 = new DrawLINE(300,  99, 300, 141);
  vert2 = new DrawLINE(298,  99, 298, 141);
  vert3 = new DrawLINE(292,  99, 292, 141);

  fl_register_images(); // Register the images.

  // Draw clef
  clefBox = new Fl_Box(95, 80, 55, 85);
  clef= new Fl_PNG_Image(tc75.png);
  clefBox-image(clef);

  // Draw note
  noteBox = new Fl_Box(200, 101, 30, 30);
  note= new Fl_PNG_Image(note.png);
  noteBox-image(note);

  entr = new Fl_Return_Button(100, 300, 80, 30, Enter);
  entr-callback( cb_getInfo, this );

  quit = new Fl_Button(250, 300, 50, 30, Quit);
  quit-callback(cb_quit, this);

  inp = new Fl_Input(200, 190, 30, 30);

   end();
   show();
}


Re: [fltk.general] Question about Fl_Input

2013-03-02 Thread edgar
 On 02/28/13 23:58, edgar wrote:
  Is it possible to send text typed into an Fl_Input box to another box 
  without using
  a callback via an enter button?

   Going to assume you meant not to have the word without in the above.

  I would like to have the user type an answer into an Input box and then hit 
  the enter key on the
  keyboard.

   Sure, just use set the callback() for the input widget to send whatever
   the user typed to the other box. eg:

 #include FL/Fl.H
 #include FL/Fl_Window.H
 #include FL/Fl_Input.H
 #include FL/Fl_Box.H
 //
 // Demonstrate Fl_Input to use Enter key to trigger callback to change 
 window's title - erco 3/1/13
 //
 void ChangeTitle(Fl_Widget *w, void *data) {
 Fl_Input  *in  = (Fl_Input*)w;
 Fl_Window *win = (Fl_Window*)data;
 win-label(in-value());// send value of Fl_Input to 
 window's title
 }
 int main(int argc,char **argv) {
 Fl_Window *win = new Fl_Window(300,100);
 Fl_Input  *in  = new Fl_Input(140,10,150,25,Type something:);
 in-callback(ChangeTitle, (void*)win);
 in-when(FL_WHEN_ENTER_KEY);
 win-show();
 return(Fl::run());
 }

  Also, if I am wanting to loop this series of events, how would I go about 
  this
  if the Input box and the other text box are dynamically allocated? Should 
  they
  be destroyed and recreated with each iteration to avoid memory leaks?

   No, just hide() and show() them as needed.

   If these widgets are in a dialog, then just hide() and show() the dialog
   window, and leave the widgets within allocated.
Thanks!  I will give this a try.  I posted my algorithm and starter code for a 
little program. You guys are great!
___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk