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

  1. VERSION 2.00
  2. Begin Form frmToolbox 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Tools"
  6.    Height          =   780
  7.    Left            =   4590
  8.    LinkTopic       =   "Form1"
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   25
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   54
  15.    Top             =   1470
  16.    Width           =   930
  17.    Begin PictureClip PicClip1 
  18.       Prop17          =   FORM1.FRX:0000
  19.       Cols            =   5
  20.       Picture         =   FORM1.FRX:0010
  21.       Rows            =   20
  22.    End
  23.    Begin ccSubClass SubClass1 
  24.       CtlParam        =   "frmToolbox"
  25.       Left            =   12
  26.       Messages        =   FORM1.FRX:D28A
  27.       Top             =   104
  28.       Type            =   1  'Post-Default
  29.    End
  30.    Begin Image Image1 
  31.       Height          =   330
  32.       Index           =   15
  33.       Left            =   0
  34.       Top             =   900
  35.       Width           =   360
  36.    End
  37.    Begin Image Image1 
  38.       Height          =   330
  39.       Index           =   14
  40.       Left            =   1440
  41.       Top             =   600
  42.       Width           =   360
  43.    End
  44.    Begin Image Image1 
  45.       Height          =   330
  46.       Index           =   13
  47.       Left            =   1080
  48.       Top             =   600
  49.       Width           =   360
  50.    End
  51.    Begin Image Image1 
  52.       Height          =   330
  53.       Index           =   12
  54.       Left            =   720
  55.       Top             =   600
  56.       Width           =   360
  57.    End
  58.    Begin Image Image1 
  59.       Height          =   330
  60.       Index           =   11
  61.       Left            =   360
  62.       Top             =   600
  63.       Width           =   360
  64.    End
  65.    Begin Image Image1 
  66.       Height          =   330
  67.       Index           =   10
  68.       Left            =   0
  69.       Top             =   600
  70.       Width           =   360
  71.    End
  72.    Begin Image Image1 
  73.       Height          =   330
  74.       Index           =   9
  75.       Left            =   1440
  76.       Top             =   300
  77.       Width           =   360
  78.    End
  79.    Begin Image Image1 
  80.       Height          =   330
  81.       Index           =   8
  82.       Left            =   1080
  83.       Top             =   300
  84.       Width           =   360
  85.    End
  86.    Begin Image Image1 
  87.       Height          =   330
  88.       Index           =   7
  89.       Left            =   720
  90.       Top             =   300
  91.       Width           =   360
  92.    End
  93.    Begin Image Image1 
  94.       Height          =   330
  95.       Index           =   6
  96.       Left            =   360
  97.       Top             =   300
  98.       Width           =   360
  99.    End
  100.    Begin Image Image1 
  101.       Height          =   330
  102.       Index           =   5
  103.       Left            =   0
  104.       Top             =   300
  105.       Width           =   360
  106.    End
  107.    Begin Image Image1 
  108.       Height          =   330
  109.       Index           =   4
  110.       Left            =   1440
  111.       Top             =   0
  112.       Width           =   360
  113.    End
  114.    Begin Image Image1 
  115.       Height          =   330
  116.       Index           =   3
  117.       Left            =   1080
  118.       Top             =   0
  119.       Width           =   360
  120.    End
  121.    Begin Image Image1 
  122.       Height          =   330
  123.       Index           =   2
  124.       Left            =   720
  125.       Top             =   0
  126.       Width           =   360
  127.    End
  128.    Begin Image Image1 
  129.       Height          =   330
  130.       Index           =   1
  131.       Left            =   360
  132.       Top             =   0
  133.       Width           =   360
  134.    End
  135.    Begin Image Image1 
  136.       Height          =   330
  137.       Index           =   0
  138.       Left            =   0
  139.       Top             =   0
  140.       Width           =   360
  141.    End
  142. Option Explicit
  143. Sub Form_Unload (Cancel As Integer)
  144.    Unload frmFlyout
  145.    frmToolbox!SubClass1.HwndParam = 0
  146.    MDIForm1!Panel.Caption = ""
  147. End Sub
  148. Sub Image1_MouseDown (Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  149.    Dim last_tool%                            ' Index of the previously selected tool.
  150.    Dim temp%                                 ' Temp var
  151.    ' The only thing we're interested in is the left mouse button.
  152.    If (Button = LEFT_BUTTON) Then
  153.       
  154.       '
  155.       ' Save, in the Toolbox structure, which icon in the toolbox was clicked on.
  156.       '
  157.       last_tool% = gToolbox.tool_selected
  158.       gToolbox.tool_selected = Index
  159.       
  160.       
  161.       '
  162.       ' Change the selected tool's icon to the depressed version.
  163.       '
  164.       frmToolbox!Image1(Index).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(Index, 0).icon_index + ICON_DEPRESSED)
  165.       
  166.       
  167.       '
  168.       ' If needed, arrange the flyout menu.
  169.       '
  170.       If (last_tool% <> gToolbox.tool_selected) Then Call ArrangeFlyout
  171.       '
  172.       ' Set the form to be sub-classed (enables sub-classing)
  173.       ' Show the flyout as modal.
  174.       '
  175.       frmFlyout!SubClass1.HwndParam = frmFlyout.hWnd
  176.       temp% = SetCapture%(frmFlyout.hWnd)
  177.       frmFlyout.Show MODELESS
  178.    End If
  179. End Sub
  180. Sub SubClass1_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, retval As Long, nodef As Integer)
  181.    Dim x%                        ' X coordinate of the mouse
  182.    Dim y%                        ' Y coordinate of the mouse
  183.    Dim row%                      ' Icon row the mouse is over
  184.    Dim column%                   ' Icon column the mouse is over
  185.    Dim image_num%                ' The index of the icon the mouse is over
  186.    ' Based on the API message received...
  187.    Select Case (msg)
  188.       '
  189.       ' Our message that is received when the user selects something on the flyout.
  190.       ' Index of flyout item selected is contained in the wp parameter.
  191.       '
  192.       Case WM_USER
  193.          
  194.          '
  195.          ' Hide the flyout window.
  196.          '
  197.          frmFlyout.Hide
  198.          
  199.          
  200.          '
  201.          ' Save the item flyout item selected in the gToolbox structure.
  202.          '
  203.          gToolbox.flyout_item_selected = wp
  204.          
  205.          
  206.          '
  207.          ' Restore the icon for the selected tool to its normal state.
  208.          '
  209.          frmToolbox!Image1(gToolbox.tool_selected).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, 0).icon_index)
  210.          
  211.          
  212.          '
  213.          ' Process the flyout menu selection.
  214.          '
  215.          Call ProcessFlyoutSelection
  216.       
  217.       
  218.       
  219.       
  220.       '
  221.       ' The user is moving the mouse in the toolbox window.
  222.       ' Determine the tool the mouse is over and display the tool's help message.
  223.       '
  224.       Case WM_MOUSEMOVE
  225.          '
  226.          ' Extract the x and y mouse coordinates from the lp parameter.
  227.          '
  228.          
  229.          Call dwDWORDto2Integers(lp, x%, y%)
  230.          
  231.          
  232.          '
  233.          ' Calculate the icon row and column the mouse is over.
  234.          '
  235.          
  236.          column% = x% \ frmToolbox!Image1(0).Width
  237.          row% = y% \ frmToolbox!Image1(0).Height
  238.          
  239.          
  240.          '
  241.          ' Determine the index of the icon the mouse is over.
  242.          ' Display the tool's help string in the MDIForm1's status panel.
  243.          '
  244.          
  245.          image_num% = (gToolbox.num_columns * row%) + column%
  246.          MDIForm1!Panel.Caption = gToolbox.icons(image_num%, 0).help_str
  247.       
  248.       
  249.       '
  250.       ' The user has moved the toolbox window.
  251.       ' Set the tool_selected field in the gToolbox structure to -1 so that
  252.       ' if the user re-selects the last tool again, a call to ArrangeToolbox
  253.       ' is forced.  If this didn't happen, the flyout would be displayed in its
  254.       ' old position, not where it should be.
  255.       '
  256.       Case WM_MOVE
  257.          gToolbox.tool_selected = -1
  258.       
  259.    End Select
  260. End Sub
  261.