Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Split form window
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Documentation de produit
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01618628
Message ID:
01618682
Vues:
51
Thank you very much for the sample code. I will try it.

>I would stick with a native implementation. ActiveX can have odd focus issues and the last thing you want is to have a splitter where focus is not setting or releasing properly.
>
>As Boris points out it's not very difficult to create a splitter in Fox code. I built a simple one for use in HTML Help Builder years ago using just MouseDown, MouseUp and MouseMove events.
>
>Here's the exported control class code:
>
>
>**************************************************
>*-- Class:        wwsplitter (c:\wwapps\wwhelp\wwhelp_ui.vcx)
>*-- ParentClass:  shape
>*-- BaseClass:    shape
>*-- Time Stamp:   04/17/15 10:21:02 AM
>*
>DEFINE CLASS wwsplitter AS shape
>
>
>	Height = 355
>	Width = 8
>	MousePointer = 9
>	BackColor = RGB(192,192,192)
>	FillColor = RGB(0,0,0)
>	BorderColor = RGB(192,192,192)
>	*-- Set when the splitter is moved. Gets set to SECONDS(). When this value is 0 the splitter is not moving
>	nsplittermove = 0
>	lverticalsplitter = .F.
>	*-- SECONDS() value saved when display was last updated. Uses the nDisplayRefresh property to determine how often to refresh.
>	nlastdisplayrefresh = 0
>	*-- Holds the SECONDS() value of the last refresh.
>	ndisplayrefresh = 0.5
>	Name = "wwsplitter"
>
>
>	*-- This method is called when the mouse is dragged, but only in timed intervals based on nRefreshDisplay.
>	PROCEDURE onrefreshdisplay
>		LPARAMETERS nButton,nShift, nXCoord, nYCoord
>	ENDPROC
>
>
>	PROCEDURE MouseMove
>		LPARAMETERS nButton, nShift, nXCoord, nYCoord
>
>		IF nButton=1 && and THISFORM.lSplitterMove <  Seconds() - .15
>		   IF THIS.nSplitterMove = 0
>		     THIS.ZOrder(0)
>		     THIS.OnStartMove()
>		   ENDIF
>		   
>		   THIS.BackColor=RGB(0,0,0)
>		   IF !THIS.lVerticalSplitter
>		      THIS.Left = nXCoord
>		   ELSE
>		      THIS.Top = nYCoord
>		   ENDIF
>		 
>		   lnSeconds = SECONDS()
>		   *** Now handle the refresh
>		   IF lnSeconds > THIS.nLastDisplayRefresh + THIS.nDisplayRefresh
>		      THIS.OnRefreshDisplay(nButton,nShift, nXCoord, nYCoord)
>		      THIS.nLastDisplayRefresh = lnSeconds
>		   ENDIF
>
>		   THIS.nSplitterMove = lnSeconds
>		ENDIF   
>	ENDPROC
>
>
>	PROCEDURE MouseUp
>		LPARAMETERS nButton, nShift, nXCoord, nYCoord
>
>		IF THIS.nSplitterMove # 0.00
>		      THIS.BackColor=THISFORM.BackColor
>		      THIS.nSplittermove=0.00
>		      THIS.OnRefreshDisplay(nButton,nShift, nXCoord, nYCoord)
>		      THIS.OnStopMove()
>		ENDIF      
>	ENDPROC
>
>
>	*-- Fires when the splitter was moved. This event fires only when the move operation completes
>	PROCEDURE onsplittermoved
>	ENDPROC
>
>
>	PROCEDURE onstartmove
>	ENDPROC
>
>
>	PROCEDURE onstopmove
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: wwsplitter
>**************************************************
>
>
>
>What I do is hide the two panes while the splitter is moving (you can show them but it can be choppy)
>
>So In OnStartMove:
>
>
>THISFORM.oViewer.visible = .F.
>THISFORM.oTree.Visible = .F.
>
>
>When done make them visible again AND refresh the page in OnStopMove:
>
>
>THISFORM.Resize()
>
>THISFORM.oTree.visible = .T.
>THISFORM.oViewer.Visible = .T.
>
>
>You can basically capture the end move operation. The form Refresh then resizes the panes:
>
>
>THIS.oSplitter.Height = THIS.Height - THIS.oStatus.Height 
>THIS.oTree.Width = THIS.oSplitter.left + 1
>THIS.oviewer.Left = THIS.oSplitter.Left + THIS.oSplitter.Width - 1
>
>THIS.oViewer.width = THIS.width - THIS.oViewer.Left + 2 
>THIS.oViewer.height = THIS.oSplitter.height -THIS.oViewer.Top 
>THIS.oTree.height = THIS.oSplitter.height - THIS.oTree.top - 1
>
>
>This is a super easy implementation and if you really wanted to you could add references to the two sections to resize and have the splitter do the resizing. For me this was a one off thing so I do the resizing as part of my form render code which is easy enough.
>
>Hope this helps,
>
>+++ Rick ---
>
>
>>>>Hi,
>>>>I am looking for some suggestions on how to implement a split-window form. Let me describe.
>>>>
>>>>The form should be divided into two, kind of like you can divide a grid with a SplitBar property. The left side of the screen will show the grid bound to a cursor. And the right side of the split form will show the selected record in a Detailed view (textboxes, combo, edit boxes, etc.).
>>>>
>>>>The trick that I need to figure out is that the user should be able to make the left side wider or narrower. So there has to be a vertical divider that user can “grab” with a mouse and slide left-right.
>>>>
>>>>I would appreciate any suggestions on how this can be implemented.
>>>>TIA
>>>
>>>Hm google will bring some results on VFP splitter.
>>>
>>>It's tricky. I can give you a brief explanation what I do
>>>
>>>I do a (transparent) shape as splitter.
>>>then you need tho have a hidden shape that covers the whole form
>>>then the thing is done via OLE drgadrop,
>>>OLEStartDrag will bring the cover topmost (zorder) while OLEDrag will put the cover in background
>>>The cover OLEDragOver will return coordinates while the splitter OEGiveFeedback does the refresh.
>>>
>>>Thats basically is what I do.
>>>
>>>This is ancient code ....
>>>
>>>
>>>Lutz
>>
>>Thank you. I will download the Active-x that Borislav referenced and see how it works. If not, I will start building it from scratch and take your input of how you done it.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform