How can I disable Ctrl+Wheel horizontal scrolling? lazarus / 9-Editor ---------------------------------------------------------------------- staratel20 · 2016-03-01 16:50 When working with code and scroll it up and down, sometime mouse cursor is on horizontal scroll-bar, which cause horizontal scroll, and this some annoying me. Is exist way to disable it? ---------------------------------------------------------------------- howardpc · 2016-03-01 17:59 Tools->Options for IDE Options dialog. Under Editor click on the Mouse node in the treeview at the left to open the Mouse page. The lower section has what looks like a line of text: Left1 Left2 Middle Wheel Right Extra1 Extra2 These are actually 'buttons'. Click on Wheel and set the first Wheel combo to Nothing/Default Then click OK. ---------------------------------------------------------------------- Martin_fr · 2016-03-01 19:18 When you are over one of the 2 scrollbars, then the mouse wheel is handled by the scrollbars. There is on option to disable it. You can try dig down into the LCL and catch/redirect the OS wheel message. But I cant currently give any advice on that. ---------------------------------------------------------------------- staratel20 · 2016-03-01 19:31 howardpc: it was good try, very close to what I need)) Martin_fr: in final(if my try will success) - it will be a patch with long approved time)). It makes me worry). There are many little improvements I can realize, many ideas. But if approve of every little thing will take so long time - it's very slow progress. Not like running cheetah on picture. UPD: no need to redirect, enough to simple disable ---------------------------------------------------------------------- Martin_fr · 2016-03-02 00:34 Maybe it is easier to avoid long lines, then you do not have a horizontal scrollbar. You can also force SynEdit to keep it hidden, even if there are long lines. But that needs to be done in code (easy in SynEdit, but in a package (that gets installed to the IDE) if you want to). SynEdit can still horizontal scroll in that case, but only by keyboard, and there is no visible indicator. You can check if any of the events available in SynEdit (or Application, there is OnUserMessage or something, not sure) allow you to catch the problematic message. (test it in a new form with only a SynEdit on it) In that case no patch is needed, you can write an addon package for the IDE, and those who want it can download it. It IDEIntf, is a unit SourceEditorIntf, that you can use in your package. It has a hook that is called for every SourceEditor created. ---------------------------------------------------------------------- staratel20 · 2016-03-02 08:15 Thanks for detail explanation Martin. I'll try some of this. But let me note, that even if it'll works for me, - I think it's also bad approach to write addon package for this. Let me explain why. The Lazarus Option have very cool filter. For example I'm a new user in Lazarus, tuning IDE. I go to Option and type in filter "scroll" "wheel" to find option I'm interest to disable horizontal scroll. And don't find it - even I found match place for this, described by howardpc. "Scroll by vertical" - it suggests itself - without any additional efforts. ---------------------------------------------------------------------- staratel20 · 2016-03-02 15:36 very dirty method on clean application, but works) : Quoteprocedure TForm1.se1MouseWheelDown(Sender: TObject; Shift: TShiftState;   MousePos: TPoint; var Handled: Boolean); begin   if (se1.ScrollBars=ssBoth)or(se1.ScrollBars=ssHorizontal) then   begin     if MousePos.y>se1.Height-20 then        Handled:=True;   end; end; procedure TForm1.se1MouseWheelUp(Sender: TObject; Shift: TShiftState;   MousePos: TPoint; var Handled: Boolean); begin   if (se1.ScrollBars=ssBoth)or(se1.ScrollBars=ssHorizontal) then   begin     if MousePos.y>se1.Height-20 then        Handled:=True;   end; end; ---------------------------------------------------------------------- Martin_fr · 2016-03-02 16:09 The question is if this should/need be an option. I do not know a single editor, or any other type of application, that has a scrollable area, and that disables the wheel for one/both scrollbar(s). You are also the first I meet who needs that. I do understand that there is a genuine issue, and of course it may be there are others but you. Probably not very many though. I am all for making an option for as many things as possible. It is always better if the app follows the need of the user, than the other way round. But there still has to be a selection process. Its not just about adding an option. The code dealing with that option must be maintained, it must be kept working for new widgetsets too. The value of a patch must be considered high enough to make good for that burden. (Also depends on how much a patch need to change / see below) I can not promise you that if you did a patch it would end up in the IDE. A package solves this. If a patch did not add much of a burden, then maybe. That would be if at least your code (as package) fulfils the following criteria, then maybe it can be ported into the IDE. - works stable on all widgetsets - does not need changes to LCL, or any existing code, except maybe minor changes in the SynEdit package (adding a generic event, on similar) - has no side effects, that is any scrollbar action that is still active works as it normally does on each OS. - If then it can be ported, so that if enabled, mouse wheel over scrollbar is handled by SynEdits mouse actions, then it might be accepted. This is quite a bit of work, and as I said no guarantee. Try the package first. ----------- Overall I am afraid but this one will not be easy. In a package you can hook the form (SourceNotebook(s) should be accesible from the events ) unit SrcEditorIntf SourceEditorManagerIntf.RegisterChangeEvent() semWindowCreate and semEditorCreate Also in a package you can assume 20 pixel height, in SynEdit, you need a better check. If it ever should go to synedit (no guarantee at all), the form is not available. But Application.AddOnUserInputHandler(@OnUserInput); may work. ---------------------------------------------------------------------- Martin_fr · 2016-03-02 16:16 I already stand corrected on not knowing any other app firefox does this. Lets see how the code turns out in a package. If it is easy to port, and does not introduce to high maintenance burden. ---------------------------------------------------------------------- staratel20 · 2016-03-02 17:09 At this time I am full of work with another project, but I note all my wishes about Lazarus for to realize it when have some time. Also I think, that thinking "you the first man, who need this" - some wrong. Lot of programmers(it's only assumption) can be reconciled with little minor discomfort while using IDE without creating new topic on forum. For example: when press Ctrl+F12 any typing part of module name be good to have ability go to first unit in list without pressing ArrowDown(at once on pressing Enter). when Paste from clipboard event name to Object inspector event - auto apply without pressing Enter(usable when one action handle some ActionList methods) and so on. It is much easy to realize and(if I'm right) - don't need to verify on every widgetset in every OS. And most of users never post this issues, because maybe repeat this step without thinking. But I'm always thinking - what routine doings takes my time when I'm programming. But anywhere - thank for your answer, think I'll do a package and post on bugtracker.