GIDForums

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Apr-2008, 09:58
shiva_crazy02 shiva_crazy02 is offline
New Member
 
Join Date: Apr 2008
Posts: 12
shiva_crazy02 is on a distinguished road

use of fluid


Dear all,
I am new in fluid of fltk.
I compiled it on my machine (Linux platform).
Now I want to make one application.
It should look like


Display ______________________



( button 1 ) ( Button 2)


when I pressed button 1 it should print "you pressed button 1" in Display,same function for Button 2.

Help me .....
thanking all of you
shiva kumar
  #2  
Old 11-Apr-2008, 22:50
shiva_crazy02 shiva_crazy02 is offline
New Member
 
Join Date: Apr 2008
Posts: 12
shiva_crazy02 is on a distinguished road

Re: use of fluid


Dear all and admin ,
You did not reply simple post.
I tried little bit .........cable_guy tutorial help me .......
here is my program .....details of all files generated by fltk are:-

My dis.fl is :-

Code:
# data file for the FLTK User Interface Designer (FLUID) version 2.1000 images_dir header_name header_name {.h} code_name {.cxx} gridx 5 gridy 5 snap 3 decl {\#include<fltk/Window.h>} {} decl {\#include <FL/Fl.H>} {} decl {\#include <FL/Fl_Input.H>} {} decl {\#include <FL/Fl_Button.H>} {} decl {//\#include<fltk/run.h>} {} decl {\#include <fltk/FL_VERSION.h>} {} namespace {fltk;} {open } { namespace {std;} {open } {} } Function {bt_callback(Fl_Widget *o,char* userdata)} {open return_type {void*} } { code {if(userdata=="u pressed tusar") { Fl_Input *i=(Fl_Input*)userdata; i->value(); } else if(userdata=="u pressed shiva") { "dis.fl" 65L, 1335C
"my dis.h file is"

CPP / C++ / C Code:
// generated by Fast Light User Interface Designer (fluid) version 2.1000

#ifndef dis_h
#define dis_h

namespace fltk;  {

namespace std;  {
}
}
void* bt_callback(Fl_Widget *o,char* userdata);
#include <fltk/Window.h>
#include <fltk/Input.h>
extern fltk::Input* display;
#include <fltk/Button.h>
extern void bt_callback(fltk::Button*, char*);
extern fltk::Button* tusar;
extern fltk::Button* shiva;
#endif

"My dis.cxx file is :-"

CPP / C++ / C Code:
// generated by Fast Light User Interface Designer (fluid) version 1.00

#include "header_name"
#include<fltk/Window.h>
#include <FL/Fl.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Button.H>
//#include<fltk/run.h>
#include <fltk/FL_VERSION.h>

void* bt_callback(Fl_Widget *o,char* userdata) {
  if(userdata=="u pressed tusar") {

                                        Fl_Input *i=(Fl_Input*)userdata;
                                        i->value();

}
else if(userdata=="u pressed shiva") {

                                        Fl_Input *j=(Fl_Input*)userdata;
                                        j->value();
}
}

int main(int argc, char **argv) {
  return Fl::run();
}
I compile it by @fltk2-config --compile dis.cxx and I tried g++ option also .......It is giving error as :-

Code:
gcc -I/usr/local/include -I/usr/include/freetype2 -Wno-non-virtual-dtor -o dis dis.cxx -L/usr/local/lib /usr/local/lib/libfltk2.a -lX11 -lXi -lXinerama -lXft -lpthread -lm -lXext -lsupc++ /tmp/cccFVt1l.o: In function `main': dis.cxx:(.text+0x50): undefined reference to `Fl::run()' collect2: ld returned 1 exit status
please help me dear .....
Thanking all of you
shiva kumar
Last edited by cable_guy_67 : 12-Apr-2008 at 06:10. Reason: Added [CODE] tags for Fluid file and [CPP] for C++ code
  #3  
Old 11-Apr-2008, 23:00
shiva_crazy02 shiva_crazy02 is offline
New Member
 
Join Date: Apr 2008
Posts: 12
shiva_crazy02 is on a distinguished road

Re: use of fluid


My system configuration is :-
fedora 8.90(werewolf)
kernel 2.6.23/-42.fc8 on i686
gcc :-4.1.2
fltk-2.0.x-r6086
shiva
  #4  
Old 12-Apr-2008, 06:21
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,102
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough

Re: use of fluid


I don't use fltk2.0 but is there some reason you have a mix of 2.0 and 1.1 code in there? Is that what Fluid 2 is outputting?

If I can get 2.0 to build I'll see what I can do but until then hopefully someone can help you out.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #5  
Old 12-Apr-2008, 09:14
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,102
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough

Re: use of fluid


Just as I thought, 2.0 is in an uncompilable state (by me with cygwin anyhow) at present. I could give it a try with an old revision (5973 in subversion) but it most likely wouldn't work for you.

Instead, I'll show an example for fltk 1.1.9, which is the current working version in subversion. It should also work the same with 1.1.8final which is the stable release.

Fluid file :
Code:
# data file for the Fltk User Interface Designer (fluid) version 1.0300 header_name {.h} code_name {.cxx} Function {buttonCB(Fl_Button*o,void*data)} {private } { code {display->value(o->label());} {} } Function {} {open } { Fl_Window {} {open xywh {331 63 153 73} type Double hide } { Fl_Output display { xywh {11 10 130 20} } Fl_Button {} { label tusar callback buttonCB xywh {10 40 64 20} } Fl_Button {} { label shiva callback buttonCB xywh {84 40 64 20} } } }

Generated .h file :
CPP / C++ / C Code:
// generated by Fast Light User Interface Designer (fluid) version 1.0300

#ifndef button_test3_h
#define button_test3_h
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Output.H>
extern Fl_Output *display;
#include <FL/Fl_Button.H>
#endif

Generated .cxx file :
CPP / C++ / C Code:
// generated by Fast Light User Interface Designer (fluid) version 1.0300

#include "button_test3.h"

static void buttonCB(Fl_Button*o,void*data) {
  display->value(o->label());
}

Fl_Output *display=(Fl_Output *)0;

int main(int argc, char **argv) {
  Fl_Double_Window* w;
  { Fl_Double_Window* o = new Fl_Double_Window(153, 73);
    w = o;
    { display = new Fl_Output(11, 10, 130, 20);
    } // Fl_Output* display
    { Fl_Button* o = new Fl_Button(10, 40, 64, 20, "tusar");
      o->callback((Fl_Callback*)buttonCB);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(84, 40, 64, 20, "shiva");
      o->callback((Fl_Callback*)buttonCB);
    } // Fl_Button* o
    o->end();
  } // Fl_Double_Window* o
  w->show(argc, argv);
  return Fl::run();
}

I would suggest using FLTK 1.1.8 as it works great. In the future this codebase is going to be migrated to 1.3 which should be,
  • UTF aware
  • Doxygen generated docs
  • using the cleaner 2.0 interface

You should still be able to see what is going on if you look at my fluid file.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #6  
Old 12-Apr-2008, 09:37
shiva_crazy02 shiva_crazy02 is offline
New Member
 
Join Date: Apr 2008
Posts: 12
shiva_crazy02 is on a distinguished road

Re: use of fluid


Dear cable guy,
I realized it before, that there is no error in coding.I had problem in version and program.
Thanking you for your reply......you are right ......I was trying fltk 1.X program with 2.X version .I thought that was the problem.
My program are
dis.cxx :-
CPP / C++ / C Code:
// generated by Fast Light User Interface Designer (fluid) version 3.1000

#include "dis.h"
#include<fltk/Window.h>
#include<fltk/Button.h>
#include<fltk/Widget.h>
#include</usr/local/include/Fl/Fl_Widget.h>
#include<FL/Fl_Menu_Item.H>

fltk::Input *display=(fltk::Input *)0;

fltk::Button *tusar=(fltk::Button *)0;

fltk::Button *shiva=(fltk::Button *)0;

#include <fltk/run.h>

int main (int argc, char **argv) {

  fltk::Window* w;
   {fltk::Window* o = new fltk::Window(240, 120);
    w = o;
    o->shortcut(0xff1b);
    o->begin();
     {fltk::Input* o = display = new fltk::Input(25, 25, 200, 25, "display");
      //o->show(argc,argv);
    }
     {fltk::Button* o = tusar = new fltk::Button(35, 60, 85, 25, "tusar");
      o->callback((fltk::Callback*)bt_callback, (void*)("tusar"));
    }
     {fltk::Button* o = shiva = new fltk::Button(155, 60, 55, 25, "shiva");
      o->callback((fltk::Callback*)bt_callback, (void*)("shiva"));
    }
    o->end();
    o->resizable(o);
  }
  w->show(argc, argv);
  return  fltk::run();
}

void bt_callback(fltk::Button* m,void* userdata) {
  if(userdata=="tusar")
                        display->text("u pressed tusar");
  else if(userdata=="shiva")
                        display->text("u pressed shiva");
}

dis.h is :-
CPP / C++ / C Code:
// generated by Fast Light User Interface Designer (fluid) version 2.1000

#ifndef dis_h
#define dis_h
#include <fltk/Window.h>
#include <fltk/Input.h>
extern fltk::Input* display;
#include <fltk/Button.h>
extern void bt_callback(fltk::Button*, void*);
extern fltk::Button* tusar;
extern fltk::Button* shiva;
void bt_callback(fltk::Button* m,void* userdata);
#endif
~
and my dis.fl is :-
Code:
# data file for the FLTK User Interface Designer (FLUID) version 2.1000 images_dir header_name header_name {.h} code_name {.cxx} gridx 5 gridy 5 snap 3 decl {\#include<fltk/Window.h>} {} decl {\#include<fltk/Button.h>} {} decl {\#include<fltk/Widget.h>} {} decl {\#include</usr/local/include/Fl/Fl_Widget.h>} {} decl {\#include<FL/Fl_Menu_Item.H>} {} Function {} {open } { {fltk::Window} {} {open xywh {3 19 240 120} hide resizable } { {fltk::Input} display { label display xywh {25 25 200 25} extra_code {//o->show(argc,argv);} } {fltk::Button} tusar { label tusar user_data {"tusar"} callback bt_callback xywh {35 60 85 25} } {fltk::Button} shiva { label shiva user_data {"shiva"} callback bt_callback } } } Function {bt_callback(fltk::Button* m,void* userdata)} {open } { code {if(userdata=="tusar") display->text("u pressed tusar"); else if(userdata=="shiva") display->text("u pressed shiva");} {} }
Again Thanking you for your reply ......Its very tough work to debug others (specially for the person who is beginner)problem
shiva kumar
Last edited by cable_guy_67 : 12-Apr-2008 at 10:24. Reason: Added [CODE] tags for Fluid file and [CPP] for C++ code
  #7  
Old 12-Apr-2008, 10:30
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,102
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough

Re: use of fluid


Quote:
Originally Posted by shiva_crazy02
Again Thanking you for your reply ......Its very tough work to debug others (specially for the person who is beginner)problem
shiva kumar

You are welcome, glad to be of help.

Quote:
Originally Posted by shiva_crazy02
Code:
decl {\#include</usr/local/include/Fl/Fl_Widget.h>} {} decl {\#include<FL/Fl_Menu_Item.H>} {}

You still are trying to use some 1.1.x stuff. You can just get rid of those lines as you already included the 2.0 versions. In fact, you should be able to get rid of all the decl blocks since the generated .h file takes care of anything you add in fluid.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #8  
Old 13-Apr-2008, 23:00
shiva_crazy02 shiva_crazy02 is offline
New Member
 
Join Date: Apr 2008
Posts: 12
shiva_crazy02 is on a distinguished road
Smile

Re: use of fluid


Thanx
I removed the headers ....It is working perfectly.
bye
shiva kumar
  #9  
Old 16-Apr-2008, 12:07
transfrank transfrank is offline
Junior Member
 
Join Date: Aug 2007
Posts: 53
transfrank is on a distinguished road

Re: use of fluid


Shiva.
Check these out:
ideos here:
http://seriss.com/people/erco/fltk-videos/
It has the compilation, fltk examples + fluid.
There are many source examples here on Erco's Cheat page:
http://seriss.com/people/erco/fltk/
And more in
C:\fltk-1.1.8\documentation
When you manage to compile the projects, you will get executables in:
C:\fltk-1.1.8\test

You should also get the manual at:
http://www.fltk.org/doc-1.1/fltk.pdf
Frank
  #10  
Old 16-Apr-2008, 23:12
shiva_crazy02 shiva_crazy02 is offline
New Member
 
Join Date: Apr 2008
Posts: 12
shiva_crazy02 is on a distinguished road

Re: use of fluid


Thanks .....
Its vey good link.
regards
shiva
 

Recent GIDBlogUpdates On The All New Toyota VIOS - Part III by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FLTK && fluid In Motion cable_guy_67 FLTK Forum 4 20-Mar-2008 03:52
Fluid with Code::Blocks tutorial bluekid FLTK Forum 4 25-Aug-2006 06:52
GIMcontacts - a gim fltk fluid venture cable_guy_67 FLTK Forum 0 14-Feb-2005 14:18
Fluid, classes and callbacks cable_guy_67 FLTK Forum 7 06-Feb-2005 13:22
Any disadvantages with FLUID? r2matthews FLTK Forum 4 14-Nov-2004 17:49

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 12:49.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.