xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XForms] fl_set_input_return(ob, FL_RETURN_ALWAYS);


From: Serge Bromow
Subject: [XForms] fl_set_input_return(ob, FL_RETURN_ALWAYS);
Date: Sat, 08 May 2010 14:00:37 -0400
User-agent: Thunderbird 2.0.0.24 (X11/20100228)

Hi Jens,

While testing I note that;

When an input object is set to "FL_RETURN_ALWAYS" the input object returns even when other buttons are pressed. I have included a program you can use to test this behaviour. The form has 2 buttons and 1 input object. With the FL_RETURN_ALWAYS set, the program return the input object first and then the button that was pressed. In previous version the input only returned when key events were received. If you comment out the FL_RETURN_ALWAYS the program returns to normal behaviour.

FL_RETURN_NONE  = ok
FL_RETURN_CHANGED = ok for buttons (only buttons return) but always returns for key events. Should only return at end if input changed.

FL_RETURN_END = always returns.
FL_RETURN_ALWAYS = always returns.

Serge

//-----------------------------------
#include<stdlib.h>


#ifndef FD_x_h_
#define FD_x_h_

#include <forms.h>

/* Callbacks, globals and object handlers */



/* Forms and Objects */

typedef struct {
    FL_FORM   * x;
    void      * vdata;
    char      * cdata;
    long        ldata;
    FL_OBJECT * back;
    FL_OBJECT * done;
    FL_OBJECT * button;
    FL_OBJECT * inp;
} FD_x;

extern FD_x * create_form_x( void );

#endif /* FD_x_h_ */


/***************************************
 ***************************************/

FD_x *create_form_x( void )
{
    FL_OBJECT *obj;
    FD_x *fdui = fl_malloc( sizeof *fdui );

    int old_bw = fl_get_border_width( );
    fl_set_border_width( -1 );

    fdui->vdata = fdui->cdata = NULL;
    fdui->ldata = 0;

    fdui->x = fl_bgn_form( FL_NO_BOX, 205, 100 );

    fdui->back = obj = fl_add_box( FL_BORDER_BOX, 0, 0, 205, 100, "" );
    fl_set_object_color( obj, FL_RIGHT_BCOL, FL_WHITE );

    fdui->done = obj = fl_add_button( FL_NORMAL_BUTTON, 0, 50, 205, 50, "Done" );
    fl_set_object_color( obj, FL_GREEN, FL_DARKER_COL1 );
    fl_set_object_lsize( obj, FL_NORMAL_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );

    fdui->button = obj = fl_add_button( FL_NORMAL_BUTTON, 0, 25, 205, 25, "Button" );
    fl_set_object_color( obj, FL_BLUE, FL_DARKER_COL1 );
    fl_set_object_lcolor( obj, FL_WHITE );
    fl_set_object_lsize( obj, FL_NORMAL_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );

    fdui->inp = obj = fl_add_input( FL_NORMAL_INPUT, 0, 0, 205, 25, "" );
    fl_set_object_color( obj, FL_WHITE, FL_WHITE );
    fl_set_object_return( obj, FL_RETURN_END_CHANGED );

    fl_end_form( );

    fdui->x->fdui = fdui;
    fl_set_border_width( old_bw );

    return fdui;
}

int main(int argc, char **argv, char **envp)
{
FD_x *fd_x;

FL_OBJECT *ob;

fl_initialize(&argc, argv, 0, 0, 0);

fd_x = create_form_x();
       
fl_show_form(fd_x->x,FL_PLACE_CENTERFREE,FL_FULLBORDER,"xkey");

fl_set_input_return(fd_x->inp, FL_RETURN_ALWAYS);

printf("VAL INPUT  %d\n", (int) fd_x->inp);
printf("VAL BUTTON %d\n", (int) fd_x->button);
printf("VAL DONE   %d\n", (int) fd_x->done);

while(1) {

    ob = fl_do_forms();
   
    printf("OB = %d\n", (int) ob);
   
    if( ob == fd_x->done ) {
        printf("Done\n");
        exit(0);
        }

    }
   
exit(0);
}

//------------------------------------

--
Serge Bromow
DineAmix Inc.
<address@hidden>
(613) 260-8629
888 411-6636
Ottawa, Canada.



IMPORTANT NOTICE: This message is intended only for the use of the individual or entity to which it is addressed. The message may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify DineAmix Inc. immediately by email at address@hidden.

Thank you. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]