Leo01010101
asked on
BCB6 DBGrid Vertical ScrollBar shouldn't change selected record
Hi, I want to set DBGrid to not allow a vertical ScrollBar to change selected record. Is it possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then you can make inherited dbgrid with WMVScroll message method overrided:
... or you can replace WindowProc method where you must ignore TWMVScroll message.
Here is example of how to replace this method...
http://stackoverflow.com/q uestions/5 397158/del phi-drag-d rop-with-l istview/53 97705#5397 705
type
TMyDBGrid = class(TDBGrid)
private
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
end;
...
implementation
procedure TMyDBGrid.WMVScroll(var Message: TWMVScroll);
begin
// inherited; //keep commented
end;
... or you can replace WindowProc method where you must ignore TWMVScroll message.
Here is example of how to replace this method...
http://stackoverflow.com/q
ASKER
I'm not sure how to implement your code in C++,
I tried to catch WM_SCROLL in this way:
but it didn't catch this event when I move a vertical scroll bar ( mouse wheel message is catched etc.. ). What could be a reason?
I tried to catch WM_SCROLL in this way:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->OnMessage = AppMessage;
}
void __fastcall TForm1::AppMessage(tagMSG &Msg, bool &Handled)
{
if( Msg.message == WM_VSCROLL )
{
Handled = true;
}
}
but it didn't catch this event when I move a vertical scroll bar ( mouse wheel message is catched etc.. ). What could be a reason?
ASKER