Пример #1
0
EVENT uiprocessdialogevent( EVENT ev, a_dialog *info )
{
    VFIELD              *field;
    a_check             *check;
    an_edit_control     *edit;
    unsigned            choice;
    a_combo_box         *combo;
    a_list              *list;

    ev = uicheckmove( ev, info );
    ev = uitabkey( ev, info );
    field = info->curr;
    if( field != NULL ) {
        switch( field->typ ) {
        case FLD_CHECK:
        case FLD_RADIO:
            switch( ev ) {
            case EV_MOUSE_DCLICK:
            case EV_MOUSE_PRESS:
            case ' ' :
                ev = EV_CHECK_BOX_CLICK;
                if( field->typ == FLD_RADIO ) {
                    do_radio( info, field );
                    break;
                }
                if( field->typ == FLD_CHECK ) {
                    info->dirty = TRUE;
                    check = field->ptr;
                    check->val = !check->val;
                    print_field( info->vs, field, TRUE );
                    break;
                }
            }
            break;
        case FLD_EDIT:
        case FLD_INVISIBLE_EDIT:
            ev = uiledit( ev );
            edit = field->ptr;
            if( info->edit_data != NULL ) {
                edit->buffer = info->edit_data->edit_buffer;
                edit->length = info->edit_data->edit_eline.length;
            }
            break;
        case FLD_LISTBOX:
        case FLD_EDIT_MLE:
            list = field->ptr;
            ev = uilistbox( ev, list, TRUE );
            break;
        case FLD_PULLDOWN:
            list = field->ptr;
            if( list->box == NULL ) {
                ev = pulldownfilter( ev, info );
            } else {
                choice = list->choice;
                ev = uilistbox( ev, list, FALSE );
                if( choice != list->choice ) {
                    info->dirty = TRUE;
                    print_field( info->vs, field, TRUE );
                }
            }
            break;
        case FLD_COMBOBOX:
            combo = field->ptr;
            list  = &combo->list;
            edit  = &combo->edit;
            if( list->box == NULL ) {
                ev = pulldownfilter( ev, info );
            } else {
                choice = list->choice;
                ev = uilistbox( ev, list, combo->perm );
                if( choice != list->choice ) {
                    info->dirty = TRUE;
                    setcombobuffer( info, field );
                    print_field( info->vs, field, TRUE );
                }
            }
            ev = uiledit( ev );
            if( info->edit_data != NULL ) {
                edit->buffer = info->edit_data->edit_buffer;
                edit->length = info->edit_data->edit_eline.length;
            }
            break;
        }
    }
    ev = uihotkeyfilter( info, ev );
    ev = uihotspotfilter( info->vs, info->fields, ev );
    return( ev );
}
Пример #2
0
ui_event uiprocessdialogevent( ui_event ui_ev, a_dialog *ui_dlg_info )
{
    VFIELD              *field;
    a_check             *check;
    an_edit_control     *edit;
    unsigned            choice;
    a_combo_box         *combo;
    a_list              *list;

    ui_ev = uicheckmove( ui_ev, ui_dlg_info );
    ui_ev = uitabkey( ui_ev, ui_dlg_info );
    field = ui_dlg_info->curr;
    if( field != NULL ) {
        switch( field->typ ) {
        case FLD_CHECK:
        case FLD_RADIO:
            switch( ui_ev ) {
            case EV_MOUSE_DCLICK:
            case EV_MOUSE_PRESS:
            case ' ' :
                ui_ev = EV_CHECK_BOX_CLICK;
                if( field->typ == FLD_RADIO ) {
                    do_radio( ui_dlg_info, field );
                    break;
                }
                if( field->typ == FLD_CHECK ) {
                    ui_dlg_info->dirty = true;
                    check = field->u.check;
                    check->val = !check->val;
                    print_field( ui_dlg_info->vs, field, true );
                    break;
                }
            }
            break;
        case FLD_EDIT:
        case FLD_INVISIBLE_EDIT:
            ui_ev = uiledit( ui_ev );
            edit = field->u.edit;
            if( ui_dlg_info->edit_data != NULL ) {
                edit->buffer = ui_dlg_info->edit_data->edit_buffer;
                edit->length = ui_dlg_info->edit_data->edit_eline.length;
            }
            break;
        case FLD_LISTBOX:
        case FLD_EDIT_MLE:
            list = field->u.list;
            ui_ev = uilistbox( ui_ev, list, true );
            break;
        case FLD_PULLDOWN:
            list = field->u.list;
            if( list->box == NULL ) {
                ui_ev = pulldownfilter( ui_ev, ui_dlg_info );
            } else {
                choice = list->choice;
                ui_ev = uilistbox( ui_ev, list, false );
                if( choice != list->choice ) {
                    ui_dlg_info->dirty = true;
                    print_field( ui_dlg_info->vs, field, true );
                }
            }
            break;
        case FLD_COMBOBOX:
            combo = field->u.combo;
            list  = &combo->list;
            edit  = &combo->edit;
            if( list->box == NULL ) {
                ui_ev = pulldownfilter( ui_ev, ui_dlg_info );
            } else {
                choice = list->choice;
                ui_ev = uilistbox( ui_ev, list, combo->perm );
                if( choice != list->choice ) {
                    ui_dlg_info->dirty = true;
                    setcombobuffer( ui_dlg_info, field );
                    print_field( ui_dlg_info->vs, field, true );
                }
            }
            ui_ev = uiledit( ui_ev );
            if( ui_dlg_info->edit_data != NULL ) {
                edit->buffer = ui_dlg_info->edit_data->edit_buffer;
                edit->length = ui_dlg_info->edit_data->edit_eline.length;
            }
            break;
        }
    }
    ui_ev = uihotkeyfilter( ui_dlg_info, ui_ev );
    ui_ev = uihotspotfilter( ui_dlg_info->vs, ui_dlg_info->fields, ui_ev );
    return( ui_ev );
}