How to handle this?

Hi,

I need your advice on this :

 (background)

 There are 4 forms :

 1. a form with width and height are fixed
 2. a grid form
 3. a graph form
 4. a memo form

The last 3 must have the ability to change the forms W&H
But it must also be possible to put them under each other as if they were one form! (So a combination of these forms, to one form must be possible!)

how would you do this?  

-> Are there ways to combine two forms to one form?
-> Maybe easier? removing caption of form?

Regards, Zif.
LVL 8
ZifNabAsked:
Who is Participating?
 
viktornetCommented:
Thank you Tom =)
0
 
viktornetCommented:
Tell me your e-mail and I'll send you some code on how to combine two forms as one. You need to write a bit code in both units... Talk to you later...

Regards,
Viktor Ivanov
0
 
dwwangCommented:
Hi Zif,

Why not try D4's docking technique? I'm not familiar with it also, but obviously it can do what you want.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
ZifNabAuthor Commented:
viktor, thanks, tom.deprez@uz.kuleuven.ac.be

dwwang, it looks like D4 is great... but unfortunately my boss doesn't want to pay for it... :-(

anyone better idea then combine two forms?

I could offcourse just set the border to bsNone...

Zif.
0
 
viktornetCommented:
Zif.....

I just sent it to you. tell me if it works ok....

Regards,
Viktor Ivanov
0
 
viktornetCommented:
What do you think is going to happen if you do this..

Form1.Parent := Form2;

What's going to be the result of this???

Cheers,
Viktor
0
 
ZifNabAuthor Commented:
hi viktor,

nice coding!

heck, didn't thought on that last one... nice!

damn, it still gives me this design problems...

When I use this, I still have to let the user push several buttons, i.e. fix the forms to each other and unfix them.

It would be nice, if the PC itself knew away to unfix them, without interact of the user...

second, i want to get rid of the caption-headings when they are fixed (at least of some of the forms). this coding should be no problem... but then how can I detect that the use wants to unfix one particular form...

Zif.
0
 
bomeCommented:
Hi,
when I understood right, it's like these floating windows that you can let float or be in one form - and in the latter case only one is visible.

I do it in this way :
I design the three forms as 3 forms in Delphis designer.

So you have the possibility to show each of the forms separately.
To put one form into the other, I just transfer the contents in the new window. This may indeed be done with the parent property.
For example, the grid should be displayed in the graph window, and the graph should disappear :
GraphForm.Graph.visible:=false;
GridForm.Visible:=false;
GridForm.Grid.Parent:=GraphForm;

When you want to display Graph and Grid in one window at once,
just leave GraphForm.Graph visible and add the grid the way above. You can then toy around with the aligned things, possibly add a Splitter between Graph and Grid, etc.

Or, make one form only to host the contents, this is probably the most flexible way. It would be an empty, invisible form at the beginning, and when you want to unify 2 forms, let the single forms disappear and put the contents in this host window.

Of course to add the memo form, you do it the same way.
When you have several components directly on a form, place a panel underneath them and transfer the panel to the new form).

Sometimes I got GPF's at the end of the program, and maybe this is due to the "wrong" child components - so maybe you would transfer the components before terminating the program to their original parents, the single forms.

Hope that scratches your problem !

bome
0
 
BlackDeathCommented:
hi, all!

vik - would you mind to send me that code you've sent to zif?
(i'm really curious)
andreas.naguschewski@vt.siemens.de

tia,

Black Death.
0
 
viktornetCommented:
It's nothing special...a few lines of code....The effect is somewhat cool, though

I;ve sent it to you...

Regards,
Viktor Ivanov
0
 
BlackDeathCommented:
thanx, vik.

Black Death.
0
 
viktornetCommented:
No prob.

Cheers,
Viktor
0
 
bryan7Commented:
I wonder... could I have that code too... ?    =)

AerithFantasy@earthling.net

bryan,

0
 
viktornetCommented:
Just sent it to ya 2...

Cheers,
Viktor
0
 
bryan7Commented:
Got it.

thanx,


bryan

0
 
Mariner080498Commented:
 If  may excuse me Viktor but I'm interesting too,and
. could I have that code too... ?    

marin@fadata.bg

Regards Mariner.
0
 
viktornetCommented:
Hello Mariner... Just sent it to ya...

btw- Are you from Bulgaria?? or if you are not do you mind telling me where are you from???

Cheers,
Viktor
0
 
viktornetCommented:
Hello Mariner =)

I just read your profile and saw you are from Bulgaria... Bulgarian Delphi freak??? :-)

Az sum ot Bulgraria sushto no ne sum ot Sofia :-) Az sum ot Etropole.Predpolagam che znaete kude e tova, no za vseki sluchai to blizko do Pravec i Botevgrad. Malko gradche... Vsushtnost sega sum v Suedinenite Americanski Shtati s roditelite mi. Kak e v Bulgaria??? Nadiavam se che vsichko e OK =)

btw(By the way) How old are you??? Oh, taka i ne razbrah imeto vi??? Imate li neshto na protiv ako mi kajete???

Cheers,
Viktor
0
 
Mariner080498Commented:
Hi Viktor ,
I get the file.
Thank you !

Once  you have my e-mail and we can
correspond !
I eill mail you!

Soon  and thank !

Regards Marin

0
 
ZifNabAuthor Commented:
viktor, answer the q'n, please. Zif.
0
 
Oli2Commented:
Hey, Victor,
since so many people allready asked for that code, why don't you just paste it in here ?
( you said, it's just a few lines... )
well... if you won't paste it here, maybe.... o.s@okay.net.......errrrrr......maybe you could send it to me....?
:-)

Greetings, Oli
0
 
viktornetCommented:
No problemo Oli bro...
======UNIT CAP=======
unit Cap;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;
type
  TForm1 = class(TForm)
    procedure FormResize(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormHide(Sender: TObject);
  public
    procedure WMMove(var Msg: TWMMove); message WM_MOVE;
  end;
var
  Form1: TForm1;
implementation
uses CapBar;
{$R *.DFM}

procedure TForm1.FormResize(Sender: TObject);
begin
  with Form2 do begin
      Top := Form1.Top + GetSystemMetrics(SM_CYFRAME) + 1;
      Left := (Form1.Left + Form1.Width) - (Width + 58);
  end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
  Form2.Show;
end;
procedure TForm1.FormHide(Sender: TObject);
begin
  Form2.Hide;
end;
procedure TForm1.WMMove(var Msg: TWMMove);
begin
  inherited;
  if (Visible) then FormResize(Self);
end;
end.
======UNIT CAPBAR=======
unit CapBar;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, Menus;
type
  TForm2 = class(TForm)
    SB: TScrollBar;
    procedure FormCreate(Sender: TObject);
    procedure SBScroll(Sender: TObject; ScrollCode: TScrollCode;
      var ScrollPos: Integer);
  end;
var
  Form2: TForm2;
implementation
uses Cap;
{$R *.DFM}
procedure TForm2.FormCreate(Sender: TObject);
begin
  Height := SB.Height - 1;
  Width := SB.Width - 1;
end;
procedure TForm2.SBScroll(Sender: TObject; ScrollCode: TScrollCode;
  var ScrollPos: Integer);
begin
  Form1.SetFocus;
end;
end.
===============
Hope you enjoy da code :))

-Viktor
--Ivanov
0
 
Oli2Commented:
Hey, Zif !
Thanx for posting the code...
.took me some time to find this question again.
Now I've got it.

Greetings, Oli
0
 
viktornetCommented:
well, it was me that posted the code by the way ;-)

get some glasses bro' :))

-Viktor
--Ivanov
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.