Use cSplitterBaseControl.pkg { OverrideProperty=Bitmap InitialValue=To } { OverrideProperty=Bitmap DesignTime=False } { OverrideProperty=Bitmap_Style InitialValue=Bitmap_Center } { OverrideProperty=Bitmap_Style DesignTime=False } { OverrideProperty=psTrackCursor InitialValue="#135" } { OverrideProperty=psTrackCursor DesignTime=False } Class cHorizontalSplitter Is A cSplitterBaseControl //**************************************************************************** // $Module type: PROCEDURE // $Module name: Construct_Object // $Author : VO // Created : 03/07/00 @ 6:37 // // Description // Creation of a storage property to hold the last Y-coordinate. The track // cursor is set to the horizontal trackcursor (#135). The classname is // different for the horizontal splitter to make it possible to load a // different cursor for the horizontal and the vertical splitter. // // $Rev History // 03/07/00 VO Module header created //**************************************************************************** Procedure Construct_Object Forward Send Construct_Object Property Integer piLastY 0 Set psTrackCursor To "#135" Set External_Class_Name "cVDFHorizontalSplitter" To "edit" Set External_Message WM_LBUTTONDOWN To OnSplitterMouseDown Set External_Message WM_LBUTTONUP To OnSplitterMouseUp Set External_Message WM_MOUSEMOVE To OnSplitterMouseMove End_Procedure // Construct_Object //**************************************************************************** // $Module type: PROCEDURE // $Module name: DoDrawDrag // $Author : VO // Created : 03/07/00 @ 6:39 // // Description // This method will drag a WINGDI rectangle to indicate the location of // the splitter. When the passed value of iTrack is 65536 the old splitter // will be removed (piLastY will probably not 65536) and a new splitter is // not drawn. // // $Rev History // 03/07/00 VO Module header created //**************************************************************************** Procedure DoDrawDrag Integer iTrack Handle hDC hBrush hBrushOld hPen hPenOld hWnd Integer iLastY iVoid iSplitterGuiLocation iXscreen iYScreen iSplitterGuiWidth Integer iSplitterGuiSize iSplitterGuiLeftTopY iSplitterGuiLeftTopX iDragDistance tWinPoint wPoint Get piLastY To iLastY Get GuiLocation To iSplitterGuiLocation Get GuiSize To iSplitterGuiSize Move (Low (iSplitterGuiSize)) To iSplitterGuiWidth Move (Hi (iSplitterGuiLocation)) To iSplitterGuiLeftTopY Move (Low (iSplitterGuiLocation)) To iSplitterGuiLeftTopX Move iSplitterGuiLeftTopY to wPoint.y Move iSplitterGuiLeftTopX to wPoint.x Delegate Get Window_Handle To hWnd Move (ClientToScreen (hWnd, AddressOf(wPoint))) to iVoid Move wPoint.x to iXscreen Move wPoint.y to iYScreen Move (GetDC (0)) To hDC Move (GetStockObject (DKGRAY_BRUSH)) To hBrush Move (GetStockObject (NULL_PEN)) To hPen Move (SetRop2 (hDC, R2_NOT)) To iVoid Move (SelectObject (hDC, hPen)) To hPenOld Move (iTrack + iYscreen) To iDragDistance If (iLastY <> 65536) Begin // erase last line Move (Rectangle (hDC, iXScreen, iLastY, iXScreen + iSplitterGuiWidth, iLastY + 4)) To iVoid End If (iTrack <> 65536) Begin Move (SelectObject (hDC, hBrush)) To hBrushOld Move (Rectangle (hDC, iXScreen, iDragDistance, iXScreen + iSplitterGuiWidth, iDragDistance + 4)) To iVoid Move (SelectObject (hDC, hBrushOld)) To iVoid End Move (SelectObject (hDC, hBrushOld)) To iVoid Move (SelectObject (hDC, hPenOld)) To iVoid Move (ReleaseDC (0, hDC)) To iVoid Set piLastY To iDragDistance End_Procedure // DoDragDraw //**************************************************************************** // $Module type: PROCEDURE // $Module name: DoSetMinMaxTrack // $Author : VO // Created : 03/06/00 @ 5:51 // // Description // This method will be called to set a default for minimum and maximum // area to drag the splitter in. // // $Rev History // 03/06/00 VO Module header created //**************************************************************************** Procedure DoSetMinMaxTrack Integer iSplitterGuiRow iParentGuiHeight Move (Hi (GuiLocation (Self))) To iSplitterGuiRow Move (Hi (GuiSize (Parent (Self)))) To iParentGuiHeight Set piMinTrack To ((iParentGuiHeight * 0.1) - iSplitterGuiRow) Set piMaxTrack To ((iParentGuiHeight * 0.9) - iSplitterGuiRow) End_Procedure // DoSetMinMaxTrack //**************************************************************************** // $Module type: PROCEDURE // $Module name: OnSplitterMouseDown // $Author : VO // Created : 03/07/00 @ 6:43 // // Description // When the mouse cursor is pressed while over the splitter object this // event is fired. The current move of already noticed (can be only within // the boundaries of the splitter height). The current boundaries of the // splitter are determined via DoSetMinMaxTrack (can be overruled at object // level) and the splitter is drawn in GDI mode. // // $Rev History // 03/07/00 VO Module header created //**************************************************************************** Procedure OnSplitterMouseDown Integer wParam Integer lParam Integer iTrack Send Set_Mouse_Capture Move (Hi (lParam)) To iTrack If (iTrack > 32000) Begin Move (iTrack - 65536) To iTrack End Send DoSetMinMaxTrack Set piLastY To 65536 Send DoDrawDrag iTrack End_Procedure // OnSplitterMouseDown //**************************************************************************** // $Module type: PROCEDURE // $Module name: OnSplitterMouseUp // $Author : VO // Created : 03/07/00 @ 6:48 // // Description // When the mouse cursor is lifted this event is fired. The current slitter // line is removed from the screen and the objects that want to be notified // of the change will be notified. The splitter itself needs to be moved // too. // // $Rev History // 03/07/00 VO Module header created //**************************************************************************** Procedure OnSplitterMouseUp Integer wParam Integer lParam Integer iMinTrack iMaxTrack iTrack Send Release_Mouse_Capture Send DoDrawDrag 65536 // Special value to erase last line Move (Hi (lParam)) To iTrack If (iTrack > 32000) Begin Move (iTrack - 65536) To iTrack End Get piMinTrack To iMinTrack Get piMaxTrack To iMaxTrack Move (iMaxTrack Min (iMinTrack Max iTrack)) To iTrack Send DoNotify iTrack Send DoMoveSelf iTrack End_Procedure // OnSplitterMouseUp //**************************************************************************** // $Module type: PROCEDURE // $Module name: DoMoveSelf // $Author : VO // Created : 03/07/00 @ 8:36 // // Description // This method is called when the splitter is moved and it will set the // location of the splitter to a different spot at the Y-axis. // // $Rev History // 03/07/00 VO Module header created //**************************************************************************** Procedure DoMoveSelf Integer iTrack Integer iGuiLocation Get GuiLocation To iGuiLocation Set GuiLocation To (Hi (iGuiLocation) + iTrack) (Low (iGuiLocation)) End_Procedure // DoMoveSelf //**************************************************************************** // $Module type: PROCEDURE // $Module name: OnSplitterMouseMove // $Author : VO // Created : 03/07/00 @ 6:53 // // Description // When the splitter is moved over the screen the splitter line needs to be // (re)drawn at the new location. This needs to be done only when the // splitter is moved with the left mouse button pressed. // // $Rev History // 03/07/00 VO Module header created //**************************************************************************** Procedure OnSplitterMouseMove Integer wParam Integer lParam Integer iMinTrack iMaxTrack iTrack If (wParam iAnd MK_LBUTTON) Begin Move (Hi (lParam)) To iTrack If (iTrack > 32000) Begin Move (iTrack - 65536) To iTrack End Get piMinTrack To iMinTrack Get piMaxTrack To iMaxTrack Move (iMaxTrack Min (iMinTrack Max iTrack)) To iTrack Send DoDrawDrag iTrack End End_Procedure // OnSplitterMouseMove End_Class // cHorizontalSplitter