1

Hi Today I encountered a new problem with MouseWheel I have written some codes in mousewheel event of my mdichild forms , when I open new mdichild form and select it and do mousewheel , it detects the event but when I click on a control on my base form and comeback to mdichild and use mouse wheel, mousewheel event is not triggered anymore unless I set focus on another MDIChildform and come back to the childform again . Please help me solve the problem Thanks

here is a sample of this problem which is a little modification on default MDIAPP template http://egmahdi.com/mdiApptemplate.rar

DrSobhani
  • 129
  • 7
  • Easy to duplicate with the 'MDI Application' template. Easy to duplicate also the question though . Answers are given to this problem f.i. in the questions: http://stackoverflow.com/questions/4172307/wmmousewheel-not-working-in-delphi - http://stackoverflow.com/questions/2251019/how-to-direct-the-mouse-wheel-input-to-control-under-cursor – Sertac Akyuz Dec 18 '10 at 00:29
  • Hi tnx , but I think they are not the same as my problem , they are talking about using mousewheel on controls which don't support mousewheel or which have not focus , but my probem is that the form has focus , even I use self.focus on mouseenter event on my child form but it does not work .also MDI application template doesn't have anything to do with mousewheel – DrSobhani Dec 18 '10 at 07:21
  • @Dr - If you put an 'OnMouseWheel' handler on the 'MDIChild' form of the MDI application template, and a control on the toolbar of 'MainForm', your problem will be duplicated. Difficult? – Sertac Akyuz Dec 18 '10 at 11:08
  • 1
    @Dr - The question may seem different - related to MDI, that's why I didn't vote to close as exact duplicate. However it is not different and the reason is the same as stated in Andreas' answer. Anyway, the answer is really an exact duplicate. Why don't you try Andreas' answer? Because it fixed the duplicated problem here. – Sertac Akyuz Dec 18 '10 at 11:11
  • There is no problem with controls which are placed on a toolbar on main form , but I have a listbox on main form which is not placed on toolbar , when i doubleclick on the listbox or just click on it and come back to MDIChild , the problem appears.here you can see this problem . it is the default MDI template ,open a new mdichild form , then click on listbox and after that on mdichildform ,scrolling mouse down and up should change the mdichildform value to wheeldata value ,but after clicking on listbox , it does not do anything . – DrSobhani Dec 18 '10 at 11:21
  • I added the sample to the end of my question . – DrSobhani Dec 18 '10 at 11:30
  • Really thanks Mr Sertac akyuz ,actually when I read your first comment I did not understand what Andreas had written :-).now the problem is solved . – DrSobhani Dec 18 '10 at 11:43
  • @Dr - You're welcome! :) I think if you could formulate your solution into an answer and accept it, it would be better for SO. – Sertac Akyuz Dec 18 '10 at 12:13

1 Answers1

0

Hi There is also another really simple answer to this problem , I noticed that when there is a control on mdichildform and I click on this control , everything is ok , so I placed a TButton on mdichildform and added button1.setfocus on form.mousedown event and everything is okay now , I also moved the button to -200 , -200 , so the button is never shown , Actually I do not have any other control on my form and I just paint on the form ,

DrSobhani
  • 129
  • 7