/*hi guys i wanna just to try read many numbers to check the change in the
progress widget
i faced two main problem :
1) when i do by declaring gases class in the main
gases *g;
g=new gases();
then
gaz1->value(g->read_value2());
it just give me the last number i entered; and this is reasonable because i
return the last
value However i need to read all 10 numbers
2) the second problem when i used the first action i found that the window
was apear with last valu
for that i changed my code and i add this method
void read_values(Fl_Widget *b,void *)
when added this method, the window apeared firts but i could not event enter
any number which means
that it didnot access the
g->read_value2()
How can I solve this problem...I hope that I exaplian my problem properly
*/
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <Fl/Fl_Input.H>
#include <Fl/Fl_Output.H>
#include <Fl/Fl_Button.H>
#include <Fl/Fl_Ask.H>
#include <winsock.h>
#include <string>
#include <iostream>
#include <string>
#include <fl/Fl_Progress.H>
//Global variables
Fl_Progress *gaz1;
/************************************************************************************************/
class gases {
public:
float R_Buthane;
float R_Methane;
float R_CM;
float R_HS;
public:
//float read_values(string gasName);
float read_values2();
} ;
float gases::read_values2()
{
float x=0;
for(int i=0;i<10;i++)
{
printf("Enter value");
scanf("%f",&x);
R_Buthane = x;
}
return R_Buthane;
}
/************************************************************************************************/
void read_values(Fl_Widget *b,void *)
{
float val;
extern Fl_Progress *gaz1;
gaz1 = (Fl_Progress *) b;
gases *g;
g=new gases();
val = g->read_values2();
gaz1->value(val);
}
int main(int argc, char *argv[]) {
Fl_Window *MainWindow = new Fl_Window(500, 300, "Test File");
//gases *g;
//g=new gases();
extern Fl_Progress *gaz1;
int progressW=75,progressH=15;
gaz1 = new Fl_Progress(20,30, progressW, progressH,"Gaz1");
//gaz1->value(g->read_values2());
gaz1->value(0);
gaz1->align(FL_ALIGN_RIGHT);
gaz1->labelsize(10);
gaz1->color(FL_WHITE,FL_RED);
MainWindow->end();
MainWindow->show(argc, argv);
Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk