Use cSplitterBaseControl.pkg // Visual DataFlex 14.0 Migration Utility, added June 19, 2008: 21:00:09 #IF (!@ >= 120) { OverrideProperty=Bitmap InitialValue=To } { OverrideProperty=Bitmap DesignTime=False } { OverrideProperty=Bitmap_Style InitialValue=Bitmap_Center } { OverrideProperty=Bitmap_Style DesignTime=False } { OverrideProperty=Size InitialValue=51,2 } { OverrideProperty=Size DesignTime=False } { OverrideProperty=psTrackCursor InitialValue="#106" } #ENDIF Class cVerticalSplitter Is A cSplitterBaseControl //**************************************************************************** // $Module type: PROCEDURE // $Module name: Construct_Object // $Author : VO // Created : 03/07/00 @ 6:42 // // Description // Creation of a storage property to hold the last X-coordinate. The track // cursor is set to the vertical trackcursor (#106). The classname is // different for the vertical 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 piLastX Public 0 Set psTrackCursor To "#106" Set External_Class_Name "cVDFVerticalSplitter" 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:43 // // 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 (piLastX 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 iLastX iVoid iSplitterGuiLocation iXscreen iYScreen iDragDistance Integer iSplitterGuiSize iSplitterGuiHeight iSplitterGuiLeftTopY iSplitterGuiLeftTopX Pointer lpsPoint String sPoint Get piLastX To iLastX Get GuiLocation To iSplitterGuiLocation Get GuiSize To iSplitterGuiSize Move (Hi (iSplitterGuiSize)) To iSplitterGuiHeight Move (Hi (iSplitterGuiLocation)) To iSplitterGuiLeftTopY Move (Low (iSplitterGuiLocation)) To iSplitterGuiLeftTopX ZeroType tPoint To sPoint Put iSplitterGuiLeftTopY To sPoint At tPoint.y Put iSplitterGuiLeftTopX To sPoint At tPoint.x GetAddress Of sPoint To lpsPoint Delegate Get Window_Handle To hWnd Move (ClientToScreen (hWnd, lpsPoint)) To iVoid GetBuff From sPoint At tPoint.x To iXscreen GetBuff From sPoint At tPoint.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 + iXscreen) To iDragDistance If (iLastX <> 65536) Begin // erase last line Move (Rectangle (hDC, iLastX, iYScreen + 1, iLastX + 4, iYScreen + iSplitterGuiHeight)) To iVoid End If (iTrack <> 65536) Begin Move (SelectObject (hDC, hBrush)) To hBrushOld Move (Rectangle (hDC, iDragDistance, iYScreen + 1, iDragDistance + 4, iYScreen + iSplitterGuiHeight)) To iVoid Move (SelectObject (hDC, hBrushOld)) To iVoid End Move (SelectObject (hDC, hPenOld)) To iVoid Move (ReleaseDC (0, hDC)) To iVoid Set piLastX 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 iSplitterGuiColumn iParentGuiWidth Move (Low (GuiLocation (Self))) To iSplitterGuiColumn Move (Low (GuiSize (Parent (Self)))) To iParentGuiWidth Set piMinTrack To ((iParentGuiWidth * 0.1) - iSplitterGuiColumn) Set piMaxTrack To ((iParentGuiWidth * 0.9) - iSplitterGuiColumn) End_Procedure // DoSetMinMaxTrack //**************************************************************************** // $Module type: PROCEDURE // $Module name: OnSplitterMouseDown // $Author : VO // Created : 03/07/00 @ 6:47 // // 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 width). 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 (Low (lParam)) To iTrack If (iTrack > 32000) Begin Move (iTrack - 65536) To iTrack End Send DoSetMinMaxTrack Set piLastX 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 (Low (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 X-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)) (Low (iGuiLocation) + iTrack) 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 (Low (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 // cVerticalSplitter