MDI Child focus problem when button is disabled
-
Hello, I cannot figure out where this problem comes from, so I'm looking for suggestions. In my windows app I have multiple MDIs open as well as a panel on the MDI Parent. This panel contains buttons that get disabled ( btn01.Enable = false; ) programmatically when another button is clicked. I can reproduce this every time: 1. The buttons and labels on this "parent" panel are enabled and populated respectively from the OnMDIChildActivate() event. 2. When a button is clicked, another button is disabled. Due to that last event the active MDI child changes to the first one opened rather than to continue with the code in the function being processed (the onClick event handler). Note: There is no event handler for the "disable button" event. Note: The OnMDIChildActivate() event takes a DataSet from the MDI Child which it uses to populate the panel. Any suggestions? Thanks, Remus
-
Hello, I cannot figure out where this problem comes from, so I'm looking for suggestions. In my windows app I have multiple MDIs open as well as a panel on the MDI Parent. This panel contains buttons that get disabled ( btn01.Enable = false; ) programmatically when another button is clicked. I can reproduce this every time: 1. The buttons and labels on this "parent" panel are enabled and populated respectively from the OnMDIChildActivate() event. 2. When a button is clicked, another button is disabled. Due to that last event the active MDI child changes to the first one opened rather than to continue with the code in the function being processed (the onClick event handler). Note: There is no event handler for the "disable button" event. Note: The OnMDIChildActivate() event takes a DataSet from the MDI Child which it uses to populate the panel. Any suggestions? Thanks, Remus
Hi, A couple fo questions - + Is the button that is being disabled on the active form or another form? + Also you say the code jumps out of the OnClick handler, did you mean focus only but code executes fine. You might have to take the long way - write a diable event that returns focus to the 'current' mdi form window.
-
Hi, A couple fo questions - + Is the button that is being disabled on the active form or another form? + Also you say the code jumps out of the OnClick handler, did you mean focus only but code executes fine. You might have to take the long way - write a diable event that returns focus to the 'current' mdi form window.
Hello, "+ Is the button that is being disabled on the active form or another form?" A: The button is found on the same panel in the MDIParent as the button that is being clicked when it is disabled. "+ Also you say the code jumps out of the onclick handler, did you mean focus only but code executes fine." A: The code after the ( Button.Enable = false; ) line is not executed - I found out through MessageBox.Show() that it is the last line executed, after which the focus shifts to another form and the OnMDIChildActivate() code is executed. And, I might add, there is plenty of code after that last line... I'm thinking that to find the 'current' mdi form window may take lots of work for every button event and such. I'm thinking more along the lines of having to create a custom button out of images as it doesn't seem to have the "jumping focus" for anything but the buttons. More suggestions are welcome - and no matter what I do for a solution, I would still like to find an explanation... Remus