Plot3D Rotates upon Selection from Dialog

Problem If I open a file dialog which is displayed on top of a Plot3D component, and I select a file by double clicking it, the Plot3D component rotates unintentionally if the clicked filename is over the Plot3D area.
Applies To Plot3D, all versions
Solution It seems that there is a problem with the VCL library. The mouse click applied to the dialog box is propagated into the Plot3D component lying behind the dialog window. A workaround for this peculiar behavior is to lock the Plot3D rotation, catch the mouse event after closing the dialog, and unlock the Plot3D rotation. The following code fragment shows how to tackle this problem:

  ma : TMouseActMode;

ma := Plot3D1.MouseAction;              // backup the current mouse mode
Plot3D1.MouseAction := maNone;          // lock the Plot3D component
if OpenDialog1.Execute then
Application.Processmessages;            // catch the propagated click
Plot3D1.MouseAction := ma;              // restore the mouse mode
Please note, that you have to include the SDL_sdlbase unit into the uses statement of your program (TMouseActMode is declared in this unit).


Last Update: 2014-10-06