工具栏中的按钮mousemove信息如何发送到状态栏panels(2)中
程序主界面是顶层表单,创建了一个工具栏类(包括几个按钮),类中添加一个用于保存父表单对象的属性(oMainform),请问如何在类中的按钮mousemove事件中调用父表单控件的事件?程序代码:
************************************************** *-- 类: mytoolbar (h:\users\ant\desktop\工具栏与状态栏沟通试验\myvcx.vcx) *-- 父类: toolbar *-- 基类: toolbar *-- 时间戳: 03/28/14 07:27:10 PM * DEFINE CLASS mytoolbar AS toolbar Caption = "Toolbar1" Height = 31 Left = 0 Top = 0 Width = 117 ShowWindow = 1 omainform = .F. Name = "mytoolbar" ADD OBJECT command1 AS commandbutton WITH ; AutoSize = .T., ; Top = 3, ; Left = 5, ; Height = 25, ; Width = 54, ; Caption = "代图标1", ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; AutoSize = .T., ; Top = 3, ; Left = 58, ; Height = 25, ; Width = 54, ; Caption = "代图标2", ; Name = "Command2" PROCEDURE Init Parameter oform This.omainform=oform &&通过omainform属性来引用父表单上所有一切。 ENDPROC PROCEDURE command1.Click *!* do form forms\frm销售管理 ENDPROC PROCEDURE command1.MouseMove LPARAMETERS nButton, nShift, nXCoord, nYCoord oMainForm.statusbar.panels(2).text="对商品的销售信息进行管理" ENDPROC PROCEDURE command2.Click *!* do form forms\frm订单 ENDPROC PROCEDURE command2.MouseMove LPARAMETERS nButton, nShift, nXCoord, nYCoord oMainForm.statusbar.panels(2).text="增加、修改、删除商品信息" ENDPROC ENDDEFINE * *-- EndDefine: mytoolbar **************************************************
程序代码:
PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN ************************************************** *-- Form: form1 (h:\users\ant\desktop\工具栏与状态栏沟通试验\mainform.scx) *-- 父类: form *-- 基类: form *-- 时间戳: 03/28/14 07:23:00 PM * DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 609 Width = 1007 ShowWindow = 2 DoCreate = .T. Caption = "Form1" toptoolbar = .F. Name = "Form1" ADD OBJECT statusbar AS olecontrol WITH ; Top = 581, ; Left = 0, ; Height = 28, ; Width = 1007, ; Align = 2, ; Name = "statusbar" PROCEDURE Activate This.TopToolBar = NewObject("MyToolBar","MyVcx") &&CreateObject This.TopToolBar.show() This.TopToolBar.dock(0) ENDPROC PROCEDURE Init SET DEFAULT TO SYS(5)+SYS(2003) ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************
状态栏用的是MS statusbar control 6.0 (sp6)
oMainForm.statusbar.panels(2).text=" ……" 就这两句代码。
mousemove代码部分显示错误:找不到对象omainform。
请名位高手帮忙指教一下,应该怎样改才能在状态栏panels(2)中正确显示出来。
我的系统是win7+VFP9 SP2 7423