Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing undocking a docked form

Status
Not open for further replies.

vgulielmus

Programmer
Jan 27, 2014
522
RO
Unlike the toolbars, a docked form can be undocked.
To prevent that, I cut the window title bar.
Now the docked form cannot be undocked, but only closed.

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


My respects,
Vilhelm-Ion Praisach
 
My apologies, I'm new on this forum.
I searched everywhere "Helpful Tip", but nothing...until I pressed "Submit Post".
I'm really sorry :-(

My respects,
Vilhelm-Ion Praisach
 
When you start a new thread, the first line asks you for the Thread Type in a options group. It defaults to question. Instead you can set your thread as Helpful Tip, News or Review:
This is located right above the subject you are asked to enter.

Bye, Olaf.
 
No need to apologise, Vilhelm-Ion. It is commendable of you to share your tips with us in this way.

As you have found, the "Helpful Tip" setting is useful for this type of post, especially if you wish other forum members to comment on it. For a more permanent contribution, consider writing an "FAQ". However, to do that, you will need to do more than simply post your code. Ideally, you should add some background information, such as what your code aims to achieve, what other solutions are available, and what the drawbacks are, if any, of your solution.

Also, when posting code (either in the forum or the FAQ section), could you please format it with [ignore]
Code:
 ...
[/ignore] tags. That way, it will be much easier to read. If you glance at many of the threads here, you will see what I mean.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank for the advices.

My respects,
Vilhelm-Ion Praisach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top