Tk-TableMatrix
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
TableMatrix.pm view on Meta::CPAN
sub ClassInit
{
my ($class,$mw) = @_;
$tkPriv{borderB1} = 1; # initialize borderB1
$mw->bind($class,'<3>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
## You might want to check for cell returned if you want to
## restrict the resizing of certain cells
$w->border('mark',$Ev->x,$Ev->y);
}
);
$mw->bind($class,'<B3-Motion>',['border','dragto',Ev('x'),Ev('y')]);
$mw->bind($class,'<1>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->Button1($Ev->x,$Ev->y);
}
);
$mw->bind($class,'<B1-Motion>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->B1Motion($Ev->x,$Ev->y);
}
);
$mw->bind($class,'<ButtonRelease-1>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$tkPriv{borderInfo} = "";
if ($w->exists)
{
$w->CancelRepeat;
$w->activate('@' . $Ev->x.",".$Ev->y);
}
}
);
$mw->bind($class,'<Shift-1>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->BeginExtend( $w->index('@' . $Ev->x.",".$Ev->y));
}
);
$mw->bind($class,'<Control-1>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->BeginToggle($w->index('@' . $Ev->x.",".$Ev->y));
}
);
$mw->bind($class,'<B1-Enter>','CancelRepeat');
$mw->bind($class,'<B1-Leave>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
if( !$tkPriv{borderInfo} ){
$tkPriv{x} = $Ev->x; $tkPriv{y} = $Ev->y;
$w->AutoScan;
}
}
);
$mw->bind($class,'<2>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->scan('mark',$Ev->x,$Ev->y);
$tkPriv{x} = $Ev->x; $tkPriv{y} = $Ev->y;
$tkPriv{'mouseMoved'} = 0;
}
);
$mw->bind($class,'<B2-Motion>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$tkPriv{'mouseMoved'} = 1 if ($Ev->x ne $tkPriv{'x'} || $Ev->y ne $tkPriv{'y'});
$w->scan('dragto',$Ev->x,$Ev->y) if ($tkPriv{'mouseMoved'});
}
);
$mw->bind($class,'<ButtonRelease-2>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->Paste($w->index('@' . $Ev->x.",".$Ev->y)) unless ($tkPriv{'mouseMoved'});
}
);
ClipboardKeysyms( $mw, $class, qw/ <Copy> <Cut> <Paste> /);
ClipboardKeysyms( $mw, $class, 'Control-c', 'Control-x', 'Control-v');
############################
$mw->bind($class,'<<Table_Commit>>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
eval
{
$w->activate('active');
}
;
}
);
# Remove this if you don't want cell commit to occur on every Leave for
# the table (via mouse) or FocusOut (loss of focus by table).
$mw->eventAdd( qw[ <<Table_Commit>> <Leave> <FocusOut> ]);
$mw->bind($class,'<Shift-Up>',['ExtendSelect',-1,0]);
$mw->bind($class,'<Shift-Down>',['ExtendSelect',1,0]);
$mw->bind($class,'<Shift-Left>',['ExtendSelect',0,-1]);
$mw->bind($class,'<Shift-Right>',['ExtendSelect',0,1]);
$mw->bind($class,'<Prior>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->yview('scroll',-1,'pages');
$w->activate('@0,0');
}
);
$mw->bind($class,'<Next>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->yview('scroll',1,'pages');
$w->activate('@0,0');
}
);
$mw->bind($class,'<Control-Prior>',['xview','scroll',-1,'pages']);
$mw->bind($class,'<Control-Next>',['xview','scroll',1,'pages']);
$mw->bind($class,'<Home>',['see','origin']);
$mw->bind($class,'<End>',['see','end']);
$mw->bind($class,'<Control-Home>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->selection('clear','all');
$w->activate('origin');
$w->selection('set','active');
$w->see('active');
}
);
$mw->bind($class,'<Control-End>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->selection('clear','all');
$w->activate('end');
$w->selection('set','active');
$w->see('active');
}
);
$mw->bind($class,'<Shift-Control-Home>',['DataExtend','origin']);
$mw->bind($class,'<Shift-Control-End>',['DataExtend','end']);
$mw->bind($class,'<Select>',['BeginSelect',Ev('index','active')]);
$mw->bind($class,'<Shift-Select>',['BeginExtend',Ev('index','active')]);
$mw->bind($class,'<Control-slash>','SelectAll');
$mw->bind($class,'<Control-backslash>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
$w->selection('clear','all') if ($w->cget(-selectmode) =~ /browse/);
}
);
$mw->bind($class,'<Up>',['MoveCell',-1,0]);
$mw->bind($class,'<Down>',['MoveCell',1,0]);
$mw->bind($class,'<Left>',['MoveCell',0,-1]);
$mw->bind($class,'<Right>',['MoveCell',0,1]);
$mw->bind($class,'<KeyPress>',['TableInsert',Ev('A')]);
$mw->bind($class,'<BackSpace>',['BackSpace']);
$mw->bind($class,'<Delete>',['delete','active','insert']);
$mw->bind($class,'<Escape>','reread');
$mw->bind($class,'<Return>',['TableInsert',"\n"]);
$mw->bind($class,'<Control-Left>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
my $posn = $w->icursor;
$w->icursor($posn - 1);
}
);
$mw->bind($class,'<Control-Right>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
my $posn = $w->icursor;
$w->icursor($posn + 1);
}
);
$mw->bind($class,'<Control-e>',['icursor','end']);
$mw->bind($class,'<Control-a>',['icursor',0]);
$mw->bind($class,'<Control-k>',['delete','active','insert','end']);
$mw->bind($class,'<Control-equal>',['ChangeWidth','active',1]);
$mw->bind($class,'<Control-minus>',['ChangeWidth','active',-1]);
TableMatrix/Spreadsheet.pm view on Meta::CPAN
# Over-ride default button release binding
# so a cell won't activate by just clicking
$mw->bind($class,'<ButtonRelease-1>',['Button1Release', $mw]);
# Edit (activate) a cell if it is double-clicked
# Or F2 is pressed
$mw->bind($class,'<Double-1>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
if ($w->exists)
{
$w->CancelRepeat;
$w->activate('@' . $Ev->x.",".$Ev->y);
}
}
);
$mw->bind($class,'<F2>',
sub
{
my $w = shift;
my $Ev = $w->XEvent;
if ($w->exists)
{
$w->CancelRepeat;
my $location = '@' . $Ev->x.",".$Ev->y;
#print "location = $location\n";
if( $w->selectionIncludes($location)){
$w->activate('@' . $Ev->x.",".$Ev->y);
}
}
}
TableMatrix/SpreadsheetHideRows.pm view on Meta::CPAN
return $indRowCols;
}
# General Motion routine. Calls cellEnter if the pointer has entered another
# cell.
sub GeneralMotion{
my $self = shift;
my $Ev = $self->XEvent;
my $rc = $self->index('@' . $Ev->x.",".$Ev->y);
$self->SUPER::GeneralMotion;
my ($row,$col) = split(',',$rc);
my @border = $self->border('mark',$Ev->x,$Ev->y);
if( scalar(@border) == 0 && (!($self->{lastrc}) || $rc ne $self->{lastrc})){ # call cellEnter if cell number has changed and we aren't on a border
$self->{lastrc} = $rc;
demos/buttons view on Meta::CPAN
my $w = shift;
$w->selectionClear('all');
});
# highlight the cell under the mouse
$t->bind('<Motion>', sub{
my $w = shift;
my $Ev = $w->XEvent;
if( $w->selectionIncludes('@' . $Ev->x.",".$Ev->y)){
Tk->break;
}
$w->selectionClear('all');
$w->selectionSet('@' . $Ev->x.",".$Ev->y);
Tk->break;
## "break" prevents the call to TableMatrixCheckBorder
});
demos/edit_styles.pl view on Meta::CPAN
{
my $w = shift;
$w->selectionClear('all');
$w->configure(-state => 'disabled');
});
# highlight the cell under the mouse
$t->bind('<Motion>', sub
{
my $w = shift;
my $Ev = $w->XEvent;
if( $w->selectionIncludes('@' . $Ev->x.",".$Ev->y)){
Tk->break;
}
$w->selectionClear('all');
$w->selectionSet('@' . $Ev->x.",".$Ev->y);
Tk->break;
## "break" prevents the call to TableMatrixCheckBorder
});
# mousebutton 1 edits the cell (or not) appropriately
$t->bind('<1>', sub
{
my ($w) = @_;
withdraw_edit_widgets($w);
my $Ev = $w->XEvent;
my ($x, $y) = ($Ev->x, $Ev->y);
my $rc = $w->index("\@$x,$y");
my $var = $w->cget(-var);
my ($r, $c) = split(/,/, $rc);
$r && $c || return;
$w->{_b1_row_col} = "$r,$c";
set_style_state($w);
my $style= $w->{columneditstyles}{$c} || 'editable';
if ($style eq 'optionmenu' || $style eq 'browseentry')
{
pTk/mTk/Tktable/tkTable.c view on Meta::CPAN
*/
static int TableWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
static int TableConfigure _ANSI_ARGS_((Tcl_Interp *interp,
Table *tablePtr, int objc, Tcl_Obj *CONST objv[],
int flags, int forceUpdate));
static void TableDestroy _ANSI_ARGS_((ClientData clientdata));
static void TableEventProc _ANSI_ARGS_((ClientData clientData,
XEvent *eventPtr));
static void TableCmdDeletedProc _ANSI_ARGS_((ClientData clientData));
static void TableRedrawHighlight _ANSI_ARGS_((Table *tablePtr));
static void TableGetGc _ANSI_ARGS_((Display *display, Drawable d,
TableTag *tagPtr, GC *tagGc));
static void TableDisplay _ANSI_ARGS_((ClientData clientdata));
static void TableFlashEvent _ANSI_ARGS_((ClientData clientdata));
static char * TableVarProc _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, Var name, char *index,
int flags));
static void TableCursorEvent _ANSI_ARGS_((ClientData clientData));
static int TableFetchSelection _ANSI_ARGS_((ClientData clientData,
int offset, char *buffer, int maxBytes));
static Tk_RestrictAction TableRestrictProc _ANSI_ARGS_((ClientData arg,
XEvent *eventPtr));
/*
* The following tables define the widget commands (and sub-
* commands) and map the indexes into the string tables into
* enumerated types used to dispatch the widget command.
*/
static CONST char *selCmdNames[] = {
"anchor", "clear", "includes", "present", "set", (char *)NULL
};
pTk/mTk/Tktable/tkTableWin.c view on Meta::CPAN
Tk_Window tkwin));
static void EmbWinRequestProc _ANSI_ARGS_((ClientData clientData,
Tk_Window tkwin));
static void EmbWinCleanup _ANSI_ARGS_((Table *tablePtr,
TableEmbWindow *ewPtr));
static int EmbWinConfigure _ANSI_ARGS_((Table *tablePtr,
TableEmbWindow *ewPtr,
int objc, Tcl_Obj *CONST objv[]));
static void EmbWinStructureProc _ANSI_ARGS_((ClientData clientData,
XEvent *eventPtr));
static void EmbWinUnmapNow _ANSI_ARGS_((Tk_Window ewTkwin,
Tk_Window tkwin));
static Tk_GeomMgr tableGeomType = {
"table", /* name */
EmbWinRequestProc, /* requestProc */
EmbWinLostSlaveProc, /* lostSlaveProc */
};
/* windows subcommands */
pTk/mTk/Tktable800/tkTableWin.c view on Meta::CPAN
Tk_Window tkwin));
static void EmbWinRequestProc _ANSI_ARGS_((ClientData clientData,
Tk_Window tkwin));
static void EmbWinCleanup _ANSI_ARGS_((Table *tablePtr,
TableEmbWindow *ewPtr));
static int EmbWinConfigure _ANSI_ARGS_((Table *tablePtr,
TableEmbWindow *ewPtr,
int objc, Tcl_Obj *CONST objv[]));
static void EmbWinStructureProc _ANSI_ARGS_((ClientData clientData,
XEvent *eventPtr));
static void EmbWinUnmapNow _ANSI_ARGS_((Tk_Window ewTkwin,
Tk_Window tkwin));
static Tk_GeomMgr tableGeomType = {
"table", /* name */
EmbWinRequestProc, /* requestProc */
EmbWinLostSlaveProc, /* lostSlaveProc */
};
/* windows subcommands */
pTk/tkTableWin.c view on Meta::CPAN
Tk_Window tkwin));
static void EmbWinRequestProc _ANSI_ARGS_((ClientData clientData,
Tk_Window tkwin));
static void EmbWinCleanup _ANSI_ARGS_((Table *tablePtr,
TableEmbWindow *ewPtr));
static int EmbWinConfigure _ANSI_ARGS_((Table *tablePtr,
TableEmbWindow *ewPtr,
int objc, Tcl_Obj *CONST objv[]));
static void EmbWinStructureProc _ANSI_ARGS_((ClientData clientData,
XEvent *eventPtr));
static void EmbWinUnmapNow _ANSI_ARGS_((Tk_Window ewTkwin,
Tk_Window tkwin));
static Tk_GeomMgr tableGeomType = {
"table", /* name */
EmbWinRequestProc, /* requestProc */
EmbWinLostSlaveProc, /* lostSlaveProc */
};
/* windows subcommands */
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.962 second using v1.00-cache-2.02-grep-82fe00e-cpan-72ae3ad1e6da )