标签: cursor-position

如何在Codemirror编辑器中设置光标位置

我正在使用codemirror 实现"查找和更正"功能.我知道有一个用于搜索和替换的插件,但它不符合我的要求.编辑器用于编写特定查询.它创造了跨度

<pre> <span class="cm-field">field</span>:jet <span class="cm-other-operator active" >adj3</span> engine <span class="cm-operator">OR</span> jet <span class="cm-other-operator" >near5</span> engine </pre>

请参考快照.如果我点击任何一个操作员(橙色),光标开始闪烁,功能正常.点击查找下一个按钮,我能够找到相应的跨度,但无法在那里设置光标.那么如何在那里设置光标位置.提前致谢. 在此输入图像描述

javascript cursor-position codemirror

4
推荐指数
1
解决办法
6468
查看次数

如何从应用程序窗口获取/设置鼠标的相对位置?

我希望能够获取鼠标指针的当前位置,相对于我的窗体窗口所在的位置。因此,如果我将鼠标放在表单的左上角,它会给我 x=0 和 y=0 的 x 和 y 值,而表单本身可能位于屏幕中间。

另外我想设置鼠标的位置。

这如何在 C# 中完成?我正在使用 Windows 窗体应用程序。

c# css-position cursor-position

3
推荐指数
1
解决办法
4147
查看次数

GetChildAtPoint方法返回错误的控件

我的表单层次结构是这样的:

Form -> TableLayoutOne -> TableLayoutTwo -> Panel -> ListBox
Run Code Online (Sandbox Code Playgroud)

在ListBox的MouseMove事件中,我有这样的代码:

    Point cursosPosition2 = PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y));
    Control crp = this.GetChildAtPoint(cursosPosition2);
    if (crp != null)
        MessageBox.Show(crp.Name);
Run Code Online (Sandbox Code Playgroud)

MessageBox向我显示"TableLayoutOne",但我希望它向我显示"ListBox".我的代码在哪里,我错了?谢谢.

c# cursor-position winforms

3
推荐指数
1
解决办法
4521
查看次数

带有TextView和Button的Listview.单击按钮的RowId

我有一个像下面这样的列表视图.TextView中的文本来自数据库.

-------------------------
TextView          Button
-------------------------
Run Code Online (Sandbox Code Playgroud)

当我单击按钮时,我想在Toast中显示此行的TextView中的文本.

我的问题如下:当我点击按钮时,我显示的是行的文本,由光标选中.我没有显示按钮所在行的文本.我知道问题是mCursor变量.

我不知道如何解决它.有人有想法吗?

这是我的ModulCursorAdapter:

public class ModuleCursorAdapter extends ResourceCursorAdapter implements OnClickListener {
private Context mContext;
private Cursor mCursor;

    public ModuleCursorAdapter(Context context, Cursor cur) {
        super(context, R.layout.notes_row, cur);
        this.mContext = context;

    }

    @Override
    public View newView(Context context, Cursor cur, ViewGroup parent) {
        LayoutInflater li = LayoutInflater.from(context);           
        return li.inflate(R.layout.notes_row, parent, false);
    }



    @Override
    public void bindView(View view, Context context, Cursor cur) {  
        this.mCursor = cur;

        TextView tvText1 = (TextView)view.findViewById(R.id.text1);            
        Button btnButtonOFF = (Button)view.findViewById(R.id.buttonOFF);

        tvText1.setText(cur.getString(cur.getColumnIndex(NotesDbAdapter.KEY_TITLE)));

        int idRow …
Run Code Online (Sandbox Code Playgroud)

android button cursor-position android-cursoradapter

3
推荐指数
1
解决办法
3160
查看次数

Android将光标从一个EditText移动到另一个EditText?

我知道很多时候都会问这些类型的问题.但仍然没有人给出完美答案.

我有问题 :

我想从EditText1**移动到另一个**EditText2 .我已经检测到editText1但是如何将光标移动到editText2.

总之,我不得不将光标位置从一个editText1直接移动到另一个EditText2.

android cursor cursor-position android-edittext

3
推荐指数
1
解决办法
2万
查看次数

GetCursorPos仅返回x值

我在MSDN论坛上看到一个线程,其中存在32位与64位整数的问题.我不确定这是不是我的问题,但好像这段代码应该有用,所以我有点困惑.

我在Windows 7 64位的兼容模式(XP SP2)中运行VB6.

Type POINTAPI ' This holds the logical cursor information
    x As Integer
    y As Integer
End Type

Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Run Code Online (Sandbox Code Playgroud)

Timer1_Timer()......

Dim mousePos As POINTAPI
Call GetCursorPos(mousePos)
MsgBox mousePos.x & " " & mousePos.y
Run Code Online (Sandbox Code Playgroud)

此消息框显示了鼠标的x坐标正确的值,但它表明"0"y,无论在哪里鼠标在屏幕上.还有,GetCursorPos()回来了1.

vb6 winapi cursor-position

3
推荐指数
1
解决办法
2085
查看次数

SetCursorPos出现故障?

我想在delphi中编写一个程序来模拟具有特定速度的移动鼠标指针(类似于AutoIT MouseMove函数).我的代码错误或SetCursorPos在被调用太多次后出现故障.这是我的功能:

procedure MoveMouse ( X, Y, Speed : Integer);
var
  P     : TPoint;
  NewX  : Integer;
  NewY  : Integer;
begin
  if X < 0 then exit;
  if Y < 0 then exit;
  if X > Screen.Height then exit;
  if Y > Screen.Width then Exit;
  repeat
    GetCursorPos(P);
    NewX := P.X;
    NewY := P.Y;
    if P.X <> X then begin
      if P.X > X then begin
        NewX := P.X - 1;
      end else begin
        NewX := P.X + 1;
      end;
    end; …
Run Code Online (Sandbox Code Playgroud)

delphi winapi cursor cursor-position

3
推荐指数
1
解决办法
1502
查看次数

如何将光标定位在AutoCompleteTextView中

在我的应用程序中,我正在使用AutoCompleteTextView.当用户选择结果项时,其中一个选项是将所选文本插入AutoCompleteTextView.插入文本后,光标返回初始位置.如何在插入的文本末尾定位它?谢谢,Eyal

android cursor-position autocompletetextview settext

3
推荐指数
1
解决办法
2567
查看次数

Ace Editor 光标在数字索引中的当前位置

是否存在任何函数或逻辑可以计算 ace 编辑器中光标当前位置(插入符号)之前的总字符数?

count caret string-length cursor-position ace-editor

3
推荐指数
1
解决办法
613
查看次数

macOS:模拟鼠标事件仅在启动二进制文件时有效,不适用于应用程序包

我有以下在 Mac 上移动鼠标光标的代码:

void moveCursorPos()
{
  CGPoint ppos;
  ppos.x = 100;
  ppos.y = 100;

  CGEventRef e = CGEventCreateMouseEvent(nullptr, kCGEventMouseMoved, ppos, kCGMouseButtonLeft);
  CGEventPost(kCGHIDEventTap, e);
  CFRelease(e);
}
Run Code Online (Sandbox Code Playgroud)

当我直接从其二进制文件运行我的软件时它可以工作 - 例如./foo.app/Contents/MacOS/foo。当我启动它时它不起作用open foo.app。做事open ./foo.app/Contents/MacOS/foo

当我第一次启动它并调用该函数时,macOS 询问我使用辅助功能 API(或类似的东西)的权限,我授予了该权限 - 如果我进入 macOS 安全设置的“辅助功能 > 隐私”窗格,所有复选框都被选中,一切都被授予foo,等等......

  • 如何在我的机器上修复它?
  • 我可以在代码方面做什么,以便我的软件的用户永远不会遇到该问题,因为它破坏了我的软件的核心 UI 交互?

macos accessibility core-graphics cursor-position

3
推荐指数
1
解决办法
529
查看次数