If iObjectType = CloseBtn Then
RaiseEvent Clicked
End If
Else
If Not (iObjectState = iDisabled) Then
If iObjectState = iPressed And iObjectType = Btn Then
iObjectState = iEnabled
RaiseEvent Clicked
End If
End If
End If
MouseUp = True
End If
End Function
If the control has been clicked we use RaiseEvent to notify the app that this is so. The app can then decide what to do based on which control has been clicked. In our case we do two things ?destroy the window and close the app:
Private Sub CloseButton_Clicked()
Window.RemoveChildren
Set Window = Nothing
End Sub
Private Sub OKButton_Clicked()
gbRun = False
End Sub
You can recreate the window by pressing the F1 key. Try it and see. I抣l wait while you do. J
Got all that? Good, then lets more on to more cool stuff.
Next Up
Open up the WindowSample4 project and take a look at the modMain module. You抣l see we抳e added RadioBtn and FrameWnd enums. Also not the constant cFrameGrey. We抣l be using this a little later on to help draw the FrameWnd control.
Next take a look at the frmMain code. We抳e added declarations for the new frame and radio button objects. Notice the two sets of radio buttons ?WindowRadio1,2, and 3 and Radio1, 2, and 3. The WindowRadio controls will go on the base window and the Radio controls will be contained by the Frame control. You抣l see that you can change a control in one group without affecting the other, just as you can in VB. This is due to the Parent/Child relationship of the clsWindow objects. We抳e also added the code to support the RaiseEvent call in the class for each of the objects. We merely set two controls that weren抰 clicked to be unchecked.
Not much has changed in the modDirectDraw module. The only thing of significance is in setting up the radio buttons that are contained by the Frame control:
With frmMain.Radio1
.ObjectType = RadioBtn
.ObjectState = iUnchecked
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




