Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

memo as a docked control

Posted on 2000-05-01
11
Medium Priority
?
639 Views
Last Modified: 2008-02-01
I simply have a TControlBar with 1 memo sitting on it. TControlBar.Align=top

TControlbar is autosize=true
The memo: dragkind=auto, dragmode=docksite

When the memo is dragged away, it forms a floating 'window' with a titlebar and small close icon. So far so good.

1. How do I put a name on the titlebar?  Usually I set the caption property of a toolbar to do this - Toolbars have a caption property, but memos do not.

2. How do I reopen the memo once the user has closed the memo by clicking on the 'x' of the floating undocked memo?

3. I want to resize my memo when it docks and resize the floating undocked window whilst the memo is floating.  How do I do this?  The dockDrop event passes a TDragDockObject which I don't know what to do with.

I am using Delphi 4

thanks for all 3 questions,
-Andy
0
Comment
Question by:abulka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 10

Expert Comment

by:Lischke
ID: 2768515
Hi Andy,

mmmmh, 3 question for 1 and then only 80 points :-/ This is not very fair but since I had recently to do with docking quite a lot I will give you the answers.

1) Use the parent of the floating memo. It is a TForm (if you have not changed that) and has therefor a Caption property.

2) Memo.Visible := True;

3) This question is unclear. You want to resize the memo, right? But to what size? There're some properties you can use to control the size for docking. Look for UndockWidth, UndockHeight, LRDockWidth and TBDockHeight.

Ciao, Mike
0
 

Author Comment

by:abulka
ID: 2786505
I'll try out your answers - thanks.  

Re Q1 - I wouldn't want the floating memo window to take on the form's caption.  Can I embed the memo in another type of control so that I can have a unique caption for it?

-Andy
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2787520
Hi Andy,

of course you can have your own floating host. Either use TControl.FloatingDockSiteClass to set a control of your choice or use the default floating dock class defined in Controls.pas. The latter needs only one assignment and works then for all controls in an application.

Ciao, Mike
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:abulka
ID: 2808120
Adjusted points from 80 to 100
0
 

Author Comment

by:abulka
ID: 2808121
Sorry to be dumb, but I designed the form visually - with a TMemo sitting in a TControlBar.  

Are you saying I need to write some code that alters the above situation in order to get a proper caption for my floating memo?  

Or should I squeeze another visual component in between the memo and the tcontrolbar component?
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2808785
Well, you must design the memo sitting on an own form not already docked to the control bar. This will give you the desired unique caption. Dock the form manually on program startup if you want it docked initially.

Ciao, Mike
0
 

Author Comment

by:abulka
ID: 2808995
Mmm - that'l mean I have to change all my references to memo2 to frmFloat.memo2

Any chance of some actual code to achieve all this?
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2809754
Would this be so hard? I think not. The major issue is that docking support in the VCL is limited to TForm, TPanel and TPageControl (well, TControl already has some basic stuff too, but this is only really used within the mentioned components). From this follows the best way to use docking (and to get the expected behavior) is to use TForm as floating host. I have seen strange effects (even not correctly painted docking handles etc.) when not using a TForm.

Handling a control on a TForm used as floating host is very simple because you must only dock the form (yes, I know, this adds another layer between the control and the real dock host). All controls on the form being docked are then automatically placed correctly. For manual docking use TControl.ManualDock.

Ciao, Mike
0
 

Author Comment

by:abulka
ID: 2812682
Ok thanks.  Could I give you some more points for some code?

Basically
 1. At start up dock the form with the memo on it.
 2. On undock, size the form to 200x200
 3. On dock, size the form back to its original length and snap it back to the leftmost edge.
0
 
LVL 10

Accepted Solution

by:
Lischke earned 300 total points
ID: 2813508
Oh, this is quite easy:

1) FormWithMemo.ManualDoc(MainForm.DockHost);
Put this into a piece of code where both forms are already existent. I often use OnActivate of the main form with a flag like FirstRun: Boolean, which is set to True in the main forms's OnCreate event and check it in the mentioned OnActivate event (where it is also reset after a successfull initialization).

2) Initialize the form's UndockWidth and UndockHeight properties in it's OnCreate event.

3) This happens automatically, because each TControl keeps its last docked height and width in its properties TBHeight (top-bottom height) and LRWidth (left-right width). To give the docked control an initial dock size use these properties to set it.

Ciao, Mike
0
 

Author Comment

by:abulka
ID: 2888982
Comment accepted as answer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question