BUG: Mouse Clicks Do Not Work on a Scrollable SDI Form with a Docked Toolbar (317499)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Visual FoxPro for Windows 7.0
This article was previously published under Q317499 SYMPTOMS
If you create a top-level (SDI) form in Visual FoxPro 6.0 or 7.0, mouse clicks on controls on the form may seem to be ignored. This problem may occur if the form is scrollable (with a ScrollBars property of more than 0), the form contains a toolbar, and the toolbar is docked to the top of the form.
RESOLUTION
To work around this problem:
- Set the ScrollBars property of the form to 0.
- Build a parent SDI form that contains a child MDI form (ShowWindow = 1 in the top-level form) and the toolbar. Configure the child form so that it has no title bar or border, and is maximized. In the Activate of the parent form, create the toolbar and child form. Because the child form is maximized and has no border or title bar, it seems as if there is only one form. The problem that is described in this article does not occur if the toolbar is docked to the top because it is actually docked in the parent form instead of the child form (which contains the controls).
The following sample code demonstrates this workaround:
*-----------------------------------
* Sample workaround code from Microsoft Knowledge Base
* article Q317499.
*-----------------------------------
PUBLIC oform1
oform1=NEWOBJECT("frmPARENT")
oform1.SHOW
RETURN
**************************************************
DEFINE CLASS frmPARENT AS FORM
TOP = 21
LEFT = 34
HEIGHT = 235
WIDTH = 422
SHOWWINDOW = 2
CAPTION = "Form1"
NAME = "Form1"
mytoolbar = .F.
frmChild = .F.
PROCEDURE ACTIVATE
IF VARTYPE(THIS.mytoolbar) != "O"
THIS.mytoolbar = NEWOBJECT("testtoolbar")
THIS.mytoolbar.DOCK(0)
THIS.mytoolbar.VISIBLE = .T.
THIS.frmChild = NEWOBJECT("frmChild")
THIS.frmChild.VISIBLE=.T.
ENDIF
ENDPROC
ENDDEFINE
**************************************************
DEFINE CLASS frmChild AS FORM
TOP = 0
LEFT = 0
HEIGHT = 344
WIDTH = 428
SHOWWINDOW = 1
SCROLLBARS = 3
BORDERSTYLE = 0
CAPTION = ""
TITLEBAR = 0
WINDOWSTATE = 2
NAME = "Form1"
ADD OBJECT pageframe1 AS PageFrame WITH ;
PAGECOUNT = 2, ;
TOP = 72, ;
LEFT = 72, ;
WIDTH = 241, ;
HEIGHT = 169, ;
NAME = "Pageframe1", ;
Page1.CAPTION = "Page1", ;
Page1.NAME = "Page1", ;
Page2.CAPTION = "Page2", ;
Page2.NAME = "Page2"
PROCEDURE CLICK
WAIT WINDOW "ChildForm Click!" NOWAIT
ENDPROC
ENDDEFINE
**************************************************
DEFINE CLASS testtoolbar AS ToolBar
CAPTION = "Toolbar1"
HEIGHT = 28
LEFT = 0
TOP = 0
WIDTH = 33
SHOWWINDOW = 1
NAME = "testtoolbar"
ADD OBJECT command1 AS CommandButton WITH ;
TOP = 3, ;
LEFT = 5, ;
HEIGHT = 22, ;
WIDTH = 23, ;
CAPTION = "", ;
NAME = "Command1"
ENDDEFINE
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 5/16/2002 |
---|
Keywords: | kbCodeSnippet kbCtrl kbDesigner kbDSupport kbprb KB317499 |
---|
|