Commit c129cdb5 authored by claes's avatar claes

Input focus didn't work

parent 3d413080
/*
* Proview $Id: rt_pb_gsd_attr_gtk.cpp,v 1.1 2007-01-04 08:42:43 claes Exp $
* Proview $Id: rt_pb_gsd_attr_gtk.cpp,v 1.2 2007-01-15 13:20:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -220,12 +220,18 @@ gboolean GsdAttrGtk::action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer
GsdAttrGtk *attr = (GsdAttrGtk *)data;
gboolean input_visible;
if ( attr->focustimer.disabled())
return FALSE;
g_object_get( attr->cmd_input, "visible", &input_visible, NULL);
if ( input_visible)
gtk_widget_grab_focus( attr->cmd_input);
else if ( attr->attrnav)
attr->attrnav->set_inputfocus();
return TRUE;
attr->focustimer.disable( 400);
return FALSE;
}
#if 0
......
/*
* Proview $Id: rt_pb_gsd_attr_gtk.h,v 1.1 2007-01-04 08:42:43 claes Exp $
* Proview $Id: rt_pb_gsd_attr_gtk.h,v 1.2 2007-01-15 13:20:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -23,6 +23,7 @@
/* rt_pb_gsd_attr_gtk.h -- Profibus gsd attribute editor */
#include "rt_pb_gsd_attr.h"
#include "co_wow_gtk.h"
class GsdAttrGtk : public GsdAttr {
public:
......@@ -40,6 +41,7 @@ class GsdAttrGtk : public GsdAttr {
GtkWidget *menubutton_cut;
GtkWidget *menubutton_paste;
GtkWidget *menubutton_changevalue;
CoWowFocusTimerGtk focustimer;
GsdAttrGtk( GtkWidget *a_parent_wid,
void *a_parent_ctx,
......
/*
* Proview $Id: rt_pb_gsd_attrnav_gtk.cpp,v 1.1 2007-01-04 08:42:43 claes Exp $
* Proview $Id: rt_pb_gsd_attrnav_gtk.cpp,v 1.2 2007-01-15 13:20:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -80,5 +80,5 @@ GsdAttrNavGtk::~GsdAttrNavGtk()
void GsdAttrNavGtk::set_inputfocus()
{
gdk_window_focus( brow_widget->window, GDK_CURRENT_TIME);
gtk_widget_grab_focus( brow_widget);
}
/*
* Proview $Id: rt_pb_gsd_attrnav.cpp,v 1.4 2007-01-04 08:42:20 claes Exp $
* Proview $Id: rt_pb_gsd_attrnav.cpp,v 1.5 2007-01-15 13:20:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -593,17 +593,20 @@ int GsdAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_GetSelectedNodes( attrnav->brow->ctx, &node_list, &node_count);
if ( !node_count) {
sts = brow_GetLast( attrnav->brow->ctx, &object);
sts = brow_GetLastVisible( attrnav->brow->ctx, &object);
if ( EVEN(sts)) return 1;
}
else {
sts = brow_GetPrevious( attrnav->brow->ctx, node_list[0], &object);
if ( EVEN(sts)) {
sts = brow_GetLast( attrnav->brow->ctx, &object);
if ( EVEN(sts)) {
if ( node_count)
if ( !brow_IsVisible( attrnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
sts = brow_GetLastVisible( attrnav->brow->ctx, &object);
if ( EVEN(sts)) return 1;
}
else {
sts = brow_GetPrevious( attrnav->brow->ctx, node_list[0], &object);
if ( EVEN(sts)) {
if ( node_count)
free( node_list);
return 1;
return 1;
}
}
}
......@@ -624,14 +627,17 @@ int GsdAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_GetSelectedNodes( attrnav->brow->ctx, &node_list, &node_count);
if ( !node_count) {
sts = brow_GetFirst( attrnav->brow->ctx, &object);
sts = brow_GetFirstVisible( attrnav->brow->ctx, &object);
if ( EVEN(sts)) return 1;
}
else {
sts = brow_GetNext( attrnav->brow->ctx, node_list[0], &object);
if ( EVEN(sts)) {
sts = brow_GetFirst( attrnav->brow->ctx, &object);
if ( EVEN(sts)) {
if ( !brow_IsVisible( attrnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
sts = brow_GetFirstVisible( attrnav->brow->ctx, &object);
if ( EVEN(sts)) return 1;
}
else {
sts = brow_GetNext( attrnav->brow->ctx, node_list[0], &object);
if ( EVEN(sts)) {
if ( node_count)
free( node_list);
return 1;
......@@ -856,6 +862,14 @@ int GsdAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_Page( attrnav->brow->ctx, -0.8);
break;
}
case flow_eEvent_ScrollDown: {
brow_Page( attrnav->brow->ctx, 0.1);
break;
}
case flow_eEvent_ScrollUp: {
brow_Page( attrnav->brow->ctx, -0.1);
break;
}
default:
;
}
......@@ -1439,6 +1453,10 @@ void GsdAttrNavBrow::brow_setup()
GsdAttrNav::brow_cb);
brow_EnableEvent( ctx, flow_eEvent_Key_PageDown, flow_eEventType_CallBack,
GsdAttrNav::brow_cb);
brow_EnableEvent( ctx, flow_eEvent_ScrollUp, flow_eEventType_CallBack,
GsdAttrNav::brow_cb);
brow_EnableEvent( ctx, flow_eEvent_ScrollDown, flow_eEventType_CallBack,
GsdAttrNav::brow_cb);
}
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment