A docked toolbars can be "glued" with a few lines of codes (e.g. NODEFAULT in events like MouseDown, DblClick).
A docked form ignores all this, and the properties like movable, are either ignored either read-only.
But with a little trick, undocking can be prevented even for forms.
It's enough to cut the titlebar.
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 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")
BINDEVENT(This.HWnd,0x0100,This,"preventclosemethod") && intercept keydown to prevent closing the window with ctrl+f4
ENDPROC
PROCEDURE preventclosemethod
LPARAMETERS p1,p2,p3,p4
ENDPROC
ENDDEFINE[/code]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.