发信人: coolyylu(GoodDay)
整理人: hunter__fox(2002-03-16 20:43:18), 站内信件
|
*---- 定义修改歌曲名称表单
DEFINE CLASS GetName as BaseForm
NewName = ''
BorderStyle = 1
*---- 模式
DeskTop = .F.
WindowType = 1
ShowWindow = 1
MinButton = .F.
MaxButton = .F.
*---- 标题宽度
nDisTitle = 15
ADD OBJECT shpBelow As Shape
ADD OBJECT PROTECTED txtNewName As TextBox WITH Width = 150 ,SpecialEffect = 1
ADD OBJECT cmdOk As CommandButton WITH Caption = "修改" ,AutoSize = .T. ,SpecialEffect = 2
ADD OBJECT cmdCancel As CommandButton WITH Caption = "取消" ,AutoSize = .T. ,Cancel = .T. ,SpecialEffect = 2
PROCEDURE Init
This.Position()
ENDPROC
PROCEDURE SetName
LPARAMETERS tcName ,tcCaption
IF EMPTY(tcCaption)
tcCaption = "ReName the song: "
ENDIF
ThisForm.txtNewName.Value = tcName
ThisForm.Caption = tcCaption + tcName
ThisForm.Print(ThisForm.Caption)
ENDPROC
PROCEDURE cmdOk.Click
ThisForm.NewName = ALLTRIM(thisform.txtNewName.Value)
thisform.Hide()
ENDPROC
PROCEDURE cmdCancel.Click
ThisForm.NewName = ""
ThisForm.Hide()
ENDPROC
PROCEDURE Position
ThisForm.txtNewName.Top = ThisForm.nDisTitle
ThisForm.cmdOk.Top = ThisForm.txtNewName.Top + ThisForm.txtNewName.Height + 10
ThisForm.cmdCancel.Top = ThisForm.txtNewName.Top + ThisForm.txtNewName.Height + 10
ThisForm.Width = this.txtNewName.Width
ThisForm.Height = ThisForm.txtNewName.Top + ThisForm.txtNewName.Height + 10 + ThisForm.cmdOk.Height + 10
ThisForm.cmdOk.Left = ThisForm.Width - ThisForm.cmdOk.Width - 10
ThisForm.cmdCancel.Left = 10
This.shpBelow.Top = ThisForm.txtNewName.Top + ThisForm.txtNewName.Height
This.shpBelow.Height = This.Height - This.shpBelow.Top
This.shpBelow.Width = This.Width
ENDPROC
ENDDEFINE
*---- 定义列表
DEFINE CLASS ObjectList as BaseForm
*---- 返回的内容
ListName = ''
*---- 对应的表
ListTable = ''
*---- 选择内容的字段
FieldName = ''
*---- 返回内容的字段
ReturnFieldName = ''
BorderStyle = 1
*---- 模式
DeskTop = .F.
WindowType = 1
ShowWindow = 1
MinButton = .F.
MaxButton = .F.
*----标题距离
nDisTitle = 15
ADD OBJECT shpBelow As Shape
ADD OBJECT PROTECTED lstSelect As ListBox WITH Width = 150 ,SpecialEffect = 1 ,RowSourceType = 6
ADD OBJECT cmdOk As CommandButton WITH Caption = "确定" ,AutoSize = .T. ,SpecialEffect = 2
ADD OBJECT cmdCancel As CommandButton WITH Caption = "取消" ,AutoSize = .T. ,Cancel = .T. ,SpecialEffect = 2
PROCEDURE Init
This.Position()
ENDPROC
PROCEDURE SetName
LPARAMETERS tcFieldName ,tcReturnFieldName ,tcTable ,tcCaption
IF NOT USED(tcTable)
USE (tcTable) IN 0
ENDIF
SELECT (tcTable)
*---- 设置参数
This.ReturnFieldName = tcReturnFieldName
This.FieldName = tcFieldName
This.ListTable = tcTable
IF EMPTY(tcCaption)
tcCaption = "Select the your favorite song album:"
ENDIF
ThisForm.lstSelect.RowSource = FORCEEXT(ThisForm.ListTable ,ThisForm.FieldName)
ThisForm.lstSelect.Refresh()
ThisForm.Caption = tcCaption
ThisForm.Print(ThisForm.Caption)
ENDPROC
PROCEDURE cmdOk.Click
ThisForm.ListName = EVALUATE(FORCEEXT(ThisForm.ListTable ,ThisForm.ReturnFieldName))
thisform.Hide()
ENDPROC
PROCEDURE cmdCancel.Click
ThisForm.ListName = ""
ThisForm.Hide()
ENDPROC
PROCEDURE Position
ThisForm.lstSelect.Top = ThisForm.nDisTitle
ThisForm.cmdOk.Top = ThisForm.lstSelect.Top + ThisForm.lstSelect.Height + 10
ThisForm.cmdCancel.Top = ThisForm.lstSelect.Top + ThisForm.lstSelect.Height + 10
ThisForm.Width = this.lstSelect.Width
ThisForm.Height = ThisForm.lstSelect.Top + ThisForm.lstSelect.Height + 10 + ThisForm.cmdOk.Height + 10
ThisForm.cmdOk.Left = ThisForm.Width - ThisForm.cmdOk.Width - 10
ThisForm.cmdCancel.Left = 10
This.shpBelow.Width = This.Width
This.shpBelow.Top = ThisForm.lstSelect.Top + ThisForm.lstSelect.Height
This.shpBelow.Height = This.Height - This.shpBelow.Top
ENDPROC
PROCEDURE Destroy
IF USED(This.ListTable)
USE IN (This.ListTable)
ENDIF
ENDPROC
ENDDEFINE
*---- 基类表单
DEFINE CLASS BaseForm as Form
TitleBar = 0
DeskTop = .T.
ForeColor = RGB(255 ,255 ,255)
BackColor = RGB(0 ,0 ,255)
nDisTitle = 20
*---- 鼠标移动
PROCEDURE MouseDown
LPARAMETERS nButton ,nShift ,nXCoord ,nYCoord
vOp1 = 274
vOp2 = 0xF012
DECLARE INTEGER ReleaseCapture IN WIN32API
DECLARE INTEGER SendMessage IN WIN32API INTEGER, INTEGER, INTEGER, INTEGER
vRes = ReleaseCapture()
vRes = SendMessage(thisform.HWnd, vOp1, vOp2,0)
CLEAR DLLS
ENDPROC
ENDDEFINE |
|