md houssy wrote:
> 
>> 2/  for the class Fl_Input how can we get the string passed into the
>> Fl_input ? Fl_input->value returns a const char*; so how can I get
>> all the text typed into the Fl_Input label ?
>  
> I don't understand the question - a char* is a text string, it holds all 
> the characters that are in the Fl_Input... What is it that you are 
> asking?---> I tried this method
>   
>        const char *login = Login_input.value;
>        const char *L= "login";
>        
>        if ((strcmp(login,L))
>        {
>         ......
>          }
> 
> but the comparison consider just the first charachter but not all the text.  

Works for me... See attached fluid file for a working example.

Note that,as I am sure you know, strcmp returns zero for strings that 
match, so your code example above is perhaos wrong?

##########################
# data file for the Fltk User Interface Designer (fluid)
version 1.0109
header_name {.h}
code_name {.cxx}
decl {\#include <stdio.h>} {}

decl {\#include <string.h>} {}

Function {} {open
} {
   Fl_Window main_win {
     label {Fl Input Test} open
     xywh {550 284 490 380} type Double visible
   } {
     Fl_Input in_val {
       label {input:}
       xywh {95 55 245 35}
     }
     Fl_Button {} {
       label {Process
Input}
       callback {// callback
int len = strlen(in_val->value());

printf("Text is \\"%s\\" and is %d chars long\\n", in_val->value(), len);

if(strcmp(in_val->value(), "login") == 0)
{
   puts("Text == login");
}

// end of callback} selected
       xywh {55 180 105 80}
     }
     Fl_Button quit_bt {
       label Quit
       callback {main_win->hide();}
       xywh {408 334 70 29}
     }
   }
}
##########################

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to