找回密码
 立即注册

QQ登录

只需一步,快速开始

zhaozimingT

高级会员

38

主题

207

帖子

1284

积分

高级会员

积分
1284

[已处理] spread 回车

zhaozimingT
高级会员   /  发表于:2016-9-22 10:51  /   查看:6141  /  回复:11
spread  for winform  回车 一次没反应,如何 在单元格输入内容回车时触发事件

11 个回复

倒序浏览
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-9-22 10:57:11
沙发
默认情况下回车会进入和退出单元格编辑状态,你期待什么效果?
回复 使用道具 举报
zhaozimingT
高级会员   /  发表于:2016-9-22 11:30:26
板凳
所以回车只是退出单元格编辑状态,然后回车才会起效果
回复 使用道具 举报
zhaozimingT
高级会员   /  发表于:2016-9-22 11:31:41
地板
能不能去了这了效果,或者用其他 方法实现Enter
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-9-22 12:08:15
5#
您可以重新定义 Enter 的行为


  1.             FarPoint.Win.Spread.InputMap im;
  2.             im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
  3.             im.Remove(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None));
  4.             im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
复制代码
回复 使用道具 举报
zhaozimingT
高级会员   /  发表于:2016-9-22 15:41:43
6#
我是想要回车处理一下 它所在单元格的内容
回复 使用道具 举报
zhaozimingT
高级会员   /  发表于:2016-9-22 16:02:55
7#
就是实现 和正常回车效果,
blob748783874.png
回复 使用道具 举报
zhaozimingT
高级会员   /  发表于:2016-9-22 16:04:32
8#
使下图具有 blob677301330.png
上图的效果
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-9-22 16:49:58
9#
您是想在编辑结束后您是想在回车后对数据进行处理然后再展示出来吗?
那如果是编辑后点击其他单元格退出编辑状态需要处理吗?如果也需要处理您可以在EditModeOff事件中处理。

如果只有回车才处理,那您可以自己实现一个activon

  1.     public class CheckValueAction : FarPoint.Win.Spread.Action
  2.     {
  3.         public override void PerformAction(object source)
  4.         {
  5.             if (source is SpreadView)
  6.             {
  7.                 SpreadView spread = (SpreadView)source;
  8.                 SheetView sheet = spread.Sheets[spread.ActiveSheetIndex];


  9.                 spread.EditMode = false;
  10.                 var value = sheet.ActiveCell.Value;
  11.                 if (value != null)
  12.                 {
  13.                     sheet.ActiveCell.Value = value.ToString() + "dd";
  14.                 }
  15.             }
  16.         }
  17.     }
复制代码
  1.             FarPoint.Win.Spread.InputMap im;
  2.             ActionMap am = fpSpread1.GetActionMap();
  3.             am.Put("CheckValue", new CheckValueAction());


  4.             im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
  5.             im.Remove(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None));
  6.             im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), "CheckValue");
复制代码


回复 使用道具 举报
zhaozimingT
高级会员   /  发表于:2016-9-27 10:39:43
10#
如何在弹窗页面获取var value = sheet.ActiveCell.Value; 这个单元格的值
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部