home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / LordLucifer / win32asm / tutorials / splitter1.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  1.9 KB  |  61 lines

  1. Multiple-Pane Splitter Bar
  2. by lord lucifer
  3. August 12, 1999
  4.  
  5. This bit of code will show you a very easy way to implement a vertical splitter
  6. (as in explorer).  Using this method, the parent window handles all of the 
  7. resizing.  The child windows are positioned so that only the space between them 
  8. shows through.  This space (which is part of the parent) is the splitter bar.  
  9.  
  10. When you create the main window's class, you may want to change the hCursor 
  11. member to IDC_SIZEWE or something similar so it changes when the mouse is put 
  12. over it.  The iSeparatorPos variable holds the current x-position of the splitter
  13. bar. 
  14.  
  15. Of course, this is not the only (or best) way to implement these splitter bars. 
  16. For instance, this method may have difficulty with more than 2 panes, or when 
  17. there are horiontal and vertical splitters... 
  18.  
  19. Note this is only a sample of how it might be implememnted, and is not an
  20. actual, working implementation.
  21.  
  22.  
  23. ; These go into the MainWindow Procedure: 
  24.      mov    eax, uMsg 
  25.      cmp    eax, WM_MOUSEMOVE 
  26.      je     wmmousemove 
  27.      cmp    eax,WM_LBUTTONDOWN 
  28.      je     wmlbuttondown 
  29.      cmp    eax,WM_LBUTTONUP 
  30.      je     wmlbuttonup  
  31.      ... 
  32.  
  33. ; mouse is moved 
  34. wmmousemove: 
  35.     test   wParam, MK_LBUTTON 
  36.     jz     return 
  37.     ; left button is down, move the splitter 
  38.     mov    eax, lParam 
  39.     and    eax, 0000FFFFh ;LOWORD(lParam = xpos) 
  40.     mov    iSeparatorPos, eax  
  41.     ; get the dimensions of the application window 
  42.     invoke GetWindowRect, hWndMainApp, addr rect 
  43.     ; re-size the left pane 
  44.     mov    eax, iSeparatorPos 
  45.     dec    eax 
  46.     invoke MoveWindow, hWndLeftPane, 0, 0, eax, rect.bottom, TRUE 
  47.     ; now re-size the right pane 
  48.     mov    eax, iSeparatorPos 
  49.     inc    eax 
  50.     invoke MoveWindow, hWndLRightPane, eax, 0, rect.right, rect.bottom, TRUE 
  51.     jmp    return 
  52.  
  53. ; Left mouse button is pressed 
  54. wmlbuttondown: 
  55.     invoke SetCapture, hWnd  
  56.     jmp    return 
  57.  
  58. ; Left mouse button is released  
  59. wmlbuttonup: 
  60.     invoke ReleaseCapture 
  61.     jmp    return