DBGrid->OnColExit() 焦点失败
void __fastcall TUsers::DBGColExit(TObject *Sender)
{
Ado->ExecSQL();
AQ4->Close();AQ4->Open();
}
更改 AQ4 表的内容(Ado 查询)并重新加载 AQ4 后 DBG (DBGrid) 也会重新加载内容。
但我仍然处于未从我的 Col 退出(列)(和行)状态,然后当我按下 Selected+1 重新加载后行时,它会选择网格的第二行,如果我按 Selected+2,它会选择第三行。
我选择的项目是第一个,但不是同时第一个。
示例:DBGrid 包含 1 2 3 4 5 我选择4并重新加载内容 然后我点击5选择2 我就是无法点击 1 2 3 4 重新加载后。
如何修复这个错误...
谢谢。
void __fastcall TUsers::DBGColExit(TObject *Sender)
{
Ado->ExecSQL();
AQ4->Close();AQ4->Open();
}
after changing content of Table for AQ4 (Ado Query) and reload AQ4
DBG (DBGrid) reloads content too.
but I'm still on not Exit from my Col (Column) (and row) and then when I press on Selected+1 after reload row it selects second row of Grid, if I press Selected+2 it selects third row.
My selected item is first but not first in the same time.
example : DBGrid contains 1 2 3 4
5 I select 4 and reload stuff
Then I click on 5 Selects 2
And I just can't click on 1 2 3 4
After reload.
how to fix this bug...
thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认真地认为“OnColExit”不是您正在做的事情的地方。
除此之外,您所描述的行为似乎不是一个错误。通过重新打开数据集,您将到达第一条记录(使用键盘而不是鼠标导航,您会明白我的意思),而网格认为这是已更改的列。
您至少应该尝试保持在同一行,例如使用书签。 Delphi 的等效代码是……。像这样;
I seriously think "OnColExit" is not the place for what you're doing.
That aside, the behaviour you're describing does not seem to be a bug. By re-opening the dataset you're landing on the first record (navigate with the keyboard instead of the mouse and you'll see what I mean), while the grid thinks it's the column what have been changed.
You should at least try to stay on the same row, by utilizing a bookmark for instance. Delphi equivalent code would be sth. like this;