Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vilhelm-Ion Praisach
  Where is Vilhelm-Ion Praisach?
 Resita
 Romania
 Vilhelm-Ion Praisach
 To: Koen Piller
  Where is Koen Piller?
 Santpoort-Zuid
 Netherlands
 Koen Piller
 Tags
Subject: RE: Docking a form
Thread ID: 396016 Message ID: 396042 # Views: 48 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Wednesday, January 22, 2014 2:07:42 PM         
   


>
> Vilhelm,
>
> are you sure? According to the help:
>
> Dockable Property
>
> nValue Description
> 0 Form does not support docking. (Default)
>
> 1 Form supports docking and is dockable. The HalfHeightCaption property is set to True (.T).
>
> 2 Form supports docking but is not dockable. The HalfHeightCaption property is set to True (.T).
>
> Regrds,
>
> Koen

I understand that the form must be docked but afterwards cannot be undocked.
With toolbars it's relatively easy, setting movable=.F. and put NODEFAULT in undock and dblclick events (if my memory doesn't trick me).
Docked forms ignores all this (tested).
Although hopeless, I tried changing TitleBar property. Nothing.
I tried docked_assign, docked_access and DockPosition_assign but none has been triggered.
I tried putting This.dock(something) in undock and even in afterdock event, but once again no effect.
I put a messagebox in This.undock and I saw that first is triggered undock (with my messagebox) with the form in the old place (docked) and only after that the form is moved and repainted (undocked).

So I simply cut the title bar form the docked form.

PUBLIC oFrm
oFrm=CREATEOBJECT("MyForm")
oFrm.show

DEFINE CLASS MyForm as Form
	dockable=1
	ADD OBJECT cmd as commandbutton
	
	PROCEDURE init
		This.Dock(2) && dock to the right side
		* cut the title bar so the window can be closed with ctrl+f4 but cannot be moved or undocked
		Declare Long SetWindowRgn IN WIN32API Long hWnd, Long hRgn, String bRedraw
		Declare Long CreateRectRgn IN WIN32API Long X1, Long Y1, Long X2, Long Y2
		SetWindowRgn(thisform.hwnd, CreateRectRgn(0,SYSMETRIC(4)+SYSMETRIC(9)/2,This.width+2*SYSMETRIC(3),This.height+2*SYSMETRIC(4)+SYSMETRIC(9)/2), "True")
	ENDPROC
ENDDEFINE


P.S.
I followed your advice and I installed the help from codeplex. It's unequivocally:

When Dockable is set to a value greater than 0, Visual FoxPro sets the properties in the following table automatically and disregards changes made to these properties. Setting Dockable to 0 does not revert these properties to their previous values.

AlwaysOnBottom Property .F.
AlwaysOnTop Property .F.
BorderStyle Property 3
Closable Property .T.
Desktop Property .F. Read-only at run time.
Enabled Property (Visual FoxPro) .T.
HalfHeightCaption Property .T.
MaxButton Property .F. Used only when Dockable is set to 2.
MDIForm Property .F.
MinButton Property .F. Used only when Dockable is set to 2.
Movable Property .T.
ScrollBars Property 0. Read-only at run time.
ShowWindow Property 0. Read-only at run time.
TitleBar Property 1
Visible Property (Visual FoxPro) .T.
WindowState Property (Visual FoxPro) 0
WindowType Property 0

When Dockable is set to a value greater than 0, Visual FoxPro disregards the following properties entirely:
MaxLeft Property
MaxTop Property
MaxWidth Property
MinHeight Property
MinWidth Property

When a form is docked, the following properties are read-only:
Left Property
Top Property
Width Property
Height Property


My respects

ENTIRE THREAD

Docking a form Posted by Victor Friedman @ 1/22/2014 10:00:26 AM
RE: Docking a form Posted by Borislav Borissov @ 1/22/2014 10:13:49 AM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 10:17:28 AM
RE: Docking a form Posted by Koen Piller @ 1/22/2014 10:39:10 AM
RE: Docking a form Posted by Koen Piller @ 1/22/2014 10:39:19 AM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 2:56:05 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 2:57:40 PM
RE: Docking a form Posted by Vilhelm-Ion Praisach @ 1/22/2014 11:48:30 AM
RE: Docking a form Posted by Koen Piller @ 1/22/2014 12:32:52 PM
RE: Docking a form Posted by Vilhelm-Ion Praisach @ 1/22/2014 2:07:42 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 3:00:42 PM
RE: Docking a form Posted by Vilhelm-Ion Praisach @ 1/22/2014 3:18:18 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 4:15:58 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 4:23:05 PM
RE: Docking a form Posted by Koen Piller @ 1/22/2014 6:27:18 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 6:54:37 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 7:21:25 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 8:20:06 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 8:52:57 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 9:02:26 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 9:45:37 PM
RE: Docking a form Posted by Koen Piller @ 1/22/2014 8:33:04 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 8:34:32 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 8:59:09 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 9:05:50 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 9:14:22 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 7:11:14 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 8:22:16 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 9:29:43 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 9:33:50 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 9:42:08 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 9:49:39 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 10:03:36 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 10:20:13 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 11:14:06 PM
RE: Docking a form Posted by Pete Sass @ 1/22/2014 11:43:19 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 10:03:38 PM
RE: Docking a form Posted by David Mustakim @ 1/22/2014 10:03:41 PM
RE: Docking a form Posted by Stefan Wuebbe @ 1/22/2014 7:19:20 PM
RE: Docking a form Posted by Victor Friedman @ 1/22/2014 8:26:11 PM