Posted on 1998-07-30
A curious little problem, but no doubt someone else has seen it before and found a solution.
Ok, if you create two forms, one with just a command button on it (form2) and then form1 with an SSpanel control (make it the size of a regular toolbar button for convenience), and then put a picture into an image control and place it in the SSpanel.
Right, now the object is to load/show form2, which will always work, but slightly differently according to if you click the image within the SSpanel, or the SSpanel itself.
Put code into the click event of the SSpanel to load form2, (show it using vbmodal) and then put code into Image1_Click to call SSpanel_Click event (saves loading the form from two differnt places).
Now what happens is that if you click on the image control then everything is fine and as it should be, but if you click on the SSpanel itself then the mouse behaves very oddly, as though it is still on form1 (although only for one click), and without clicking the mouse once (anywhere, on form1 or form2) then you wont be able to click the command button on form2. Basically it doesn't seem to have recognised the vbmodal status of form2 until you click something again. The problem with this is that not only is it annoying, but if the mouse is in the same position as the SSpanel when you make the second click, then you'll get an error, because you're trying to show an already vbmodalised form. On the other hand, if you show the form without being vbmodal then no problem.
Things I've tried :
a) deleting the code and starting again
b) doing a DoEvents in just about every possible place
c) calling an empty Form_Click event where I thought
it might help.
By the way, if you break out of the code and try to F8 through it then you wont see the problem, because strangely enough this will actually cause it to work.
Any comments welcome, but grateful if you don't lock the question up unless you really do have a solution. Like I said it's very simple to emulate the problem, so maybe try it yourself first if you think your solution will work.
Thanks in advance. Dave