home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form frmFlyout BackColor = &H00C0C0C0& BorderStyle = 1 'Fixed Single ControlBox = 0 'False Height = 2130 Left = 3570 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 115 ScaleMode = 3 'Pixel ScaleWidth = 139 Top = 1290 Width = 2205 Begin ccSubClass SubClass1 Left = 100 Messages = FORM2.FRX:0000 Top = 80 End Begin Image Image1 Height = 330 Index = 15 Left = 0 Top = 900 Width = 360 End Begin Image Image1 Height = 330 Index = 14 Left = 1440 Top = 600 Width = 360 End Begin Image Image1 Height = 330 Index = 13 Left = 1080 Top = 600 Width = 360 End Begin Image Image1 Height = 330 Index = 12 Left = 720 Top = 600 Width = 360 End Begin Image Image1 Height = 330 Index = 11 Left = 360 Top = 600 Width = 360 End Begin Image Image1 Height = 330 Index = 10 Left = 0 Top = 600 Width = 360 End Begin Image Image1 Height = 330 Index = 9 Left = 1440 Top = 300 Width = 360 End Begin Image Image1 Height = 330 Index = 8 Left = 1080 Top = 300 Width = 360 End Begin Image Image1 Height = 330 Index = 7 Left = 720 Top = 300 Width = 360 End Begin Image Image1 Height = 330 Index = 6 Left = 360 Top = 300 Width = 360 End Begin Image Image1 Height = 330 Index = 5 Left = 0 Top = 300 Width = 360 End Begin Image Image1 Height = 330 Index = 4 Left = 1440 Top = 0 Width = 360 End Begin Image Image1 Height = 330 Index = 3 Left = 1080 Top = 0 Width = 360 End Begin Image Image1 Height = 330 Index = 2 Left = 720 Top = 0 Width = 360 End Begin Image Image1 Height = 330 Index = 1 Left = 360 Top = 0 Width = 360 End Begin Image Image1 Height = 330 Index = 0 Left = 0 Top = 0 Width = 360 End Option Explicit Dim LastIndexPressed% Sub Form_Load () ' Set the form's global var LastIndexPressed% to -1. LastIndexPressed% = -1 End Sub Sub SubClass1_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, retval As Long, nodef As Integer) Dim x% ' X coordinate of the mouse Dim y% ' Y coordinate of the mouse Dim row% ' Icon row the mouse is over Dim column% ' Icon column the mouse is over Dim image_num% ' The index of the icon the mouse is over Dim temp_str$ ' Temp var Dim temp% ' Temp var ' Based on the message received... Select Case (msg) ' ' Mouse has moved. ' Case WM_MOUSEMOVE ' ' Do some common stuff. ' GoSub WM_DataExtract ' ' Determine the help message to be displayed. ' If (image_num% < 0) Then temp_str$ = "" Else temp_str$ = gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).help_str End If ' ' If the left mouse button is depressed, change the icons as needed. ' If (wp And MK_LBUTTON) Then ' ' If the image number is different than the index in LastIndexPressed%... ' If (image_num% <> LastIndexPressed%) Then ' ' Set the previously depressed icon to the normal state. (if needed). ' If (LastIndexPressed% > -1) Then frmFlyout!Image1(LastIndexPressed%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (LastIndexPressed% + 1)).icon_index) End If ' ' If the mouse is over one of the icons in the flyout, show the depressed ' version of the current icon and set the var LastIndexPressed%. ' Otherwise, set the var LastIndexPressed% to -1. ' If (image_num% > -1) Then frmFlyout!Image1(image_num%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).icon_index + ICON_DEPRESSED) LastIndexPressed% = image_num% Else LastIndexPressed% = -1 End If End If End If ' ' Display the help message in the MDIForm's status line. ' MDIForm1!Panel.Caption = temp_str$ ' ' Left mouse button has been depressed. ' Case WM_LBUTTONDOWN ' ' Do some common stuff. ' GoSub WM_DataExtract ' ' Determine the help message to be displayed. ' If (image_num% < 0) Then temp_str$ = "" Else temp_str$ = gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).help_str End If ' ' If the image number is different than the index in LastIndexPressed%... ' If (image_num% <> LastIndexPressed%) Then ' ' Set the previously depressed icon to the normal state. (if needed). ' If (LastIndexPressed% > -1) Then frmFlyout!Image1(LastIndexPressed%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (LastIndexPressed% + 1)).icon_index) End If ' ' If the mouse is over one of the icons in the flyout, show the depressed ' version of the current icon and set the var LastIndexPressed%. ' Otherwise, set the var LastIndexPressed% to -1. ' If (image_num% > -1) Then frmFlyout!Image1(image_num%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).icon_index + ICON_DEPRESSED) LastIndexPressed% = image_num% Else LastIndexPressed% = -1 End If End If ' ' Display the help message in the MDIForm's status line. ' MDIForm1!Panel.Caption = temp_str$ ' ' Left mouse button has been released. ' Case WM_LBUTTONUP ' ' Do some common stuff. ' GoSub WM_DataExtract ' ' If the mouse is over an icon, restore it to its normal state. ' If (image_num% > -1) Then frmFlyout!Image1(image_num%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).icon_index) End If ' ' Clear the status line in the MDIForm1 window. ' Set the LastIndexPressed% var to -1. ' Release the mouse capture. ' Set the form to sub-class to 0 (stop sub-classing this window). ' Post a message to the toolbox indicating what flyout item was selected. ' MDIForm1!Panel.Caption = "" LastIndexPressed% = -1 Call ReleaseCapture frmFlyout!SubClass1.HwndParam = 0 temp% = PostMessage%(frmToolbox.hWnd, WM_USER, image_num%, 0&) End Select Exit Sub WM_DataExtract: ' Extract the x and y mouse coordinates from the lp parameter. Call dwDWORDto2Integers(lp, x%, y%) ' Calculate the icon row and column the mouse is over. column% = x% \ frmFlyout!Image1(0).Width row% = y% \ frmFlyout!Image1(0).Height ' Determine the index of the icon the mouse is over. ' Take into account the fact that the mouse may be outside the flyout window. If ((column% >= gToolbox.flyout_data(gToolbox.tool_selected).num_columns) Or (row% >= gToolbox.flyout_data(gToolbox.tool_selected).num_rows) Or (x% < 0) Or (y% < 0)) Then image_num% = -1 Else image_num% = (gToolbox.flyout_data(gToolbox.tool_selected).num_columns * row%) + column% End If Return End Sub