home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / FLYOUT / FORM2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1992-12-26  |  9.9 KB  |  297 lines

  1. VERSION 2.00
  2. Begin Form frmFlyout 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    ControlBox      =   0   'False
  6.    Height          =   2130
  7.    Left            =   3570
  8.    LinkTopic       =   "Form2"
  9.    MaxButton       =   0   'False
  10.    MinButton       =   0   'False
  11.    ScaleHeight     =   115
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   139
  14.    Top             =   1290
  15.    Width           =   2205
  16.    Begin ccSubClass SubClass1 
  17.       Left            =   100
  18.       Messages        =   FORM2.FRX:0000
  19.       Top             =   80
  20.    End
  21.    Begin Image Image1 
  22.       Height          =   330
  23.       Index           =   15
  24.       Left            =   0
  25.       Top             =   900
  26.       Width           =   360
  27.    End
  28.    Begin Image Image1 
  29.       Height          =   330
  30.       Index           =   14
  31.       Left            =   1440
  32.       Top             =   600
  33.       Width           =   360
  34.    End
  35.    Begin Image Image1 
  36.       Height          =   330
  37.       Index           =   13
  38.       Left            =   1080
  39.       Top             =   600
  40.       Width           =   360
  41.    End
  42.    Begin Image Image1 
  43.       Height          =   330
  44.       Index           =   12
  45.       Left            =   720
  46.       Top             =   600
  47.       Width           =   360
  48.    End
  49.    Begin Image Image1 
  50.       Height          =   330
  51.       Index           =   11
  52.       Left            =   360
  53.       Top             =   600
  54.       Width           =   360
  55.    End
  56.    Begin Image Image1 
  57.       Height          =   330
  58.       Index           =   10
  59.       Left            =   0
  60.       Top             =   600
  61.       Width           =   360
  62.    End
  63.    Begin Image Image1 
  64.       Height          =   330
  65.       Index           =   9
  66.       Left            =   1440
  67.       Top             =   300
  68.       Width           =   360
  69.    End
  70.    Begin Image Image1 
  71.       Height          =   330
  72.       Index           =   8
  73.       Left            =   1080
  74.       Top             =   300
  75.       Width           =   360
  76.    End
  77.    Begin Image Image1 
  78.       Height          =   330
  79.       Index           =   7
  80.       Left            =   720
  81.       Top             =   300
  82.       Width           =   360
  83.    End
  84.    Begin Image Image1 
  85.       Height          =   330
  86.       Index           =   6
  87.       Left            =   360
  88.       Top             =   300
  89.       Width           =   360
  90.    End
  91.    Begin Image Image1 
  92.       Height          =   330
  93.       Index           =   5
  94.       Left            =   0
  95.       Top             =   300
  96.       Width           =   360
  97.    End
  98.    Begin Image Image1 
  99.       Height          =   330
  100.       Index           =   4
  101.       Left            =   1440
  102.       Top             =   0
  103.       Width           =   360
  104.    End
  105.    Begin Image Image1 
  106.       Height          =   330
  107.       Index           =   3
  108.       Left            =   1080
  109.       Top             =   0
  110.       Width           =   360
  111.    End
  112.    Begin Image Image1 
  113.       Height          =   330
  114.       Index           =   2
  115.       Left            =   720
  116.       Top             =   0
  117.       Width           =   360
  118.    End
  119.    Begin Image Image1 
  120.       Height          =   330
  121.       Index           =   1
  122.       Left            =   360
  123.       Top             =   0
  124.       Width           =   360
  125.    End
  126.    Begin Image Image1 
  127.       Height          =   330
  128.       Index           =   0
  129.       Left            =   0
  130.       Top             =   0
  131.       Width           =   360
  132.    End
  133. Option Explicit
  134. Dim LastIndexPressed%
  135. Sub Form_Load ()
  136.    ' Set the form's global var LastIndexPressed% to -1.
  137.    LastIndexPressed% = -1
  138. End Sub
  139. Sub SubClass1_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, retval As Long, nodef As Integer)
  140.    Dim x%                        ' X coordinate of the mouse
  141.    Dim y%                        ' Y coordinate of the mouse
  142.    Dim row%                      ' Icon row the mouse is over
  143.    Dim column%                   ' Icon column the mouse is over
  144.    Dim image_num%                ' The index of the icon the mouse is over
  145.    Dim temp_str$                 ' Temp var
  146.    Dim temp%                     ' Temp var
  147.    ' Based on the message received...
  148.    Select Case (msg)
  149.       '
  150.       ' Mouse has moved.
  151.       '
  152.       Case WM_MOUSEMOVE
  153.          '
  154.          ' Do some common stuff.
  155.          '
  156.          GoSub WM_DataExtract
  157.          '
  158.          ' Determine the help message to be displayed.
  159.          '
  160.          If (image_num% < 0) Then
  161.             temp_str$ = ""
  162.          Else
  163.             temp_str$ = gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).help_str
  164.          End If
  165.          
  166.          
  167.          '
  168.          ' If the left mouse button is depressed, change the icons as needed.
  169.          '
  170.          If (wp And MK_LBUTTON) Then
  171.          
  172.             '
  173.             ' If the image number is different than the index in LastIndexPressed%...
  174.             '
  175.             If (image_num% <> LastIndexPressed%) Then
  176.                '
  177.                ' Set the previously depressed icon to the normal state. (if needed).
  178.                '
  179.                If (LastIndexPressed% > -1) Then
  180.                   frmFlyout!Image1(LastIndexPressed%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (LastIndexPressed% + 1)).icon_index)
  181.                End If
  182.                
  183.                '
  184.                ' If the mouse is over one of the icons in the flyout, show the depressed
  185.                ' version of the current icon and set the var LastIndexPressed%.
  186.                ' Otherwise, set the var LastIndexPressed% to -1.
  187.                '
  188.                
  189.                If (image_num% > -1) Then
  190.                   frmFlyout!Image1(image_num%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).icon_index + ICON_DEPRESSED)
  191.                   LastIndexPressed% = image_num%
  192.                Else
  193.                   LastIndexPressed% = -1
  194.                End If
  195.             End If
  196.          End If
  197.          
  198.          '
  199.          ' Display the help message in the MDIForm's status line.
  200.          '
  201.          MDIForm1!Panel.Caption = temp_str$
  202.       
  203.       
  204.       '
  205.       ' Left mouse button has been depressed.
  206.       '
  207.       Case WM_LBUTTONDOWN
  208.          '
  209.          ' Do some common stuff.
  210.          '
  211.          GoSub WM_DataExtract
  212.          '
  213.          ' Determine the help message to be displayed.
  214.          '
  215.          If (image_num% < 0) Then
  216.             temp_str$ = ""
  217.          Else
  218.             temp_str$ = gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).help_str
  219.          End If
  220.          
  221.          
  222.          '
  223.          ' If the image number is different than the index in LastIndexPressed%...
  224.          '
  225.          If (image_num% <> LastIndexPressed%) Then
  226.             '
  227.             ' Set the previously depressed icon to the normal state. (if needed).
  228.             '
  229.             If (LastIndexPressed% > -1) Then
  230.                frmFlyout!Image1(LastIndexPressed%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (LastIndexPressed% + 1)).icon_index)
  231.             End If
  232.             
  233.             '
  234.             ' If the mouse is over one of the icons in the flyout, show the depressed
  235.             ' version of the current icon and set the var LastIndexPressed%.
  236.             ' Otherwise, set the var LastIndexPressed% to -1.
  237.             '
  238.             
  239.             If (image_num% > -1) Then
  240.                frmFlyout!Image1(image_num%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).icon_index + ICON_DEPRESSED)
  241.                LastIndexPressed% = image_num%
  242.             Else
  243.                LastIndexPressed% = -1
  244.             End If
  245.          End If
  246.          
  247.          '
  248.          ' Display the help message in the MDIForm's status line.
  249.          '
  250.          MDIForm1!Panel.Caption = temp_str$
  251.       '
  252.       ' Left mouse button has been released.
  253.       '
  254.       Case WM_LBUTTONUP
  255.          '
  256.          ' Do some common stuff.
  257.          '
  258.          GoSub WM_DataExtract
  259.          
  260.          '
  261.          ' If the mouse is over an icon, restore it to its normal state.
  262.          '
  263.          If (image_num% > -1) Then
  264.             frmFlyout!Image1(image_num%).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, (image_num% + 1)).icon_index)
  265.          End If
  266.          
  267.          
  268.          '
  269.          ' Clear the status line in the MDIForm1 window.
  270.          ' Set the LastIndexPressed% var to -1.
  271.          ' Release the mouse capture.
  272.          ' Set the form to sub-class to 0  (stop sub-classing this window).
  273.          ' Post a message to the toolbox indicating what flyout item was selected.
  274.          '
  275.          MDIForm1!Panel.Caption = ""
  276.          LastIndexPressed% = -1
  277.          Call ReleaseCapture
  278.          frmFlyout!SubClass1.HwndParam = 0
  279.          temp% = PostMessage%(frmToolbox.hWnd, WM_USER, image_num%, 0&)
  280.    End Select
  281.    Exit Sub
  282. WM_DataExtract:
  283.    ' Extract the x and y mouse coordinates from the lp parameter.
  284.    Call dwDWORDto2Integers(lp, x%, y%)
  285.    ' Calculate the icon row and column the mouse is over.
  286.    column% = x% \ frmFlyout!Image1(0).Width
  287.    row% = y% \ frmFlyout!Image1(0).Height
  288.    ' Determine the index of the icon the mouse is over.
  289.    ' Take into account the fact that the mouse may be outside the flyout window.
  290.    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
  291.       image_num% = -1
  292.    Else
  293.       image_num% = (gToolbox.flyout_data(gToolbox.tool_selected).num_columns * row%) + column%
  294.    End If
  295. Return
  296. End Sub
  297.