手册
1. API介绍
1.1  DWInputMethodCreate
1.2  DWInputMethodRelease
1.3  DWInputMethodOption
1.4  DWInputMethodShow
1.5  DWInputMethodHide
1.6  DWInputMethodReset
1.7  DWInputMethodShowing
1.8  DWInputMethodGetMode
1.9  DWInputMethodGetPos
1.10  DWInputMethodGetSize
1.11  DWInputMethodCommitFunc
1.12. 二次封装API
1.12.1  DWIM_SetPos
1.12.2  DWIM_SetSize
1.12.3  DWIM_SetMode
1.12.4  DWIM_SetT9Symb
1.12.5  DWIM_SetCss
1.12.6  DWIM_SetMoveable
1.12.7  DWIM_SetBool
1.12.8  DWIM_SetInt
1.12.9  DWIM_SetString
1.12.10  DWIM_SetColor
2. 自动弹出Hook
2.1  Open
2.2  Start
2.3  Stop
2.4  SetKeyboard
2.5  SetAutoHide
2.6  SetAutoMode
2.7  AddAutoMode
2.8  SetAutoPos
2.9  AddAutoShow
2.10  ExcludeAutoShow
2.11  ExcludeAutoHide
2.12  Close
3  例子代码

SetAutoPos

235
文子
2023-11-02 11:45:00

接口定义:

void AutoPopupHandler_SetAutoPos(void * handler, int flag, int offsetX, int offsetY)

设置焦点自动跟随。


参数 handler, 是由 AutoPopupHandler_Open 创建的指针。

参数flag,是设置跟随模式:0不跟随,1跟随控件,2跟随鼠标

参数offsetX,设置跟随X方向的偏移量

参数offsetY,设置跟随Y方向的偏移量


例子代码:

void MainWindow::Init()
{
    mHandler = AutoPopupHandler_Open();
    AutoPopupHandler_SetAutoHide(mHandler, true);      
    AutoPopupHandler_AddAutoMode(mHandler, "editName", "py26.lay");  
    AutoPopupHandler_AddAutoMode(mHandler, "editPhone", "phone.lay");
    AutoPopupHandler_SetAutoMode(mHandler, true);      
    AutoPopupHandler_SetAutoPos(mHandler, 2, 0, 30);   // 设置为2即跟随鼠标,无X偏移,Y偏移30即,相对于输入框向下移30个像素。
    AutoPopupHandler_Start(mHandler, this);
    AutoPopupHandler_SetKeyboard(mHandler, g_IM);
}