Solved

How to handle this?

Posted on 1998-10-21
24
263 Views
Last Modified: 2010-04-06
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.
0
Comment
Question by:ZifNab
  • 11
  • 3
  • 2
  • +5
24 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1343665
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
 
LVL 4

Expert Comment

by:dwwang
ID: 1343666
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
 
LVL 8

Author Comment

by:ZifNab
ID: 1343667
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
 
LVL 10

Expert Comment

by:viktornet
ID: 1343668
Zif.....

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

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1343669
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
 
LVL 8

Author Comment

by:ZifNab
ID: 1343670
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
 

Expert Comment

by:bome
ID: 1343671
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
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1343672
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
 
LVL 10

Expert Comment

by:viktornet
ID: 1343673
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
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1343674
thanx, vik.

Black Death.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1343675
No prob.

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1343676
I wonder... could I have that code too... ?    =)

AerithFantasy@earthling.net

bryan,

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

by:viktornet
ID: 1343677
Just sent it to ya 2...

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1343678
Got it.

thanx,


bryan

0
 

Expert Comment

by:Mariner080498
ID: 1343679
 If  may excuse me Viktor but I'm interesting too,and
. could I have that code too... ?    

marin@fadata.bg

Regards Mariner.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1343680
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
 
LVL 10

Expert Comment

by:viktornet
ID: 1343681
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
 

Expert Comment

by:Mariner080498
ID: 1343682
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
 
LVL 8

Author Comment

by:ZifNab
ID: 1343683
viktor, answer the q'n, please. Zif.
0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1343684
Thank you Tom =)
0
 
LVL 1

Expert Comment

by:Oli2
ID: 1343685
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
 
LVL 10

Expert Comment

by:viktornet
ID: 1343686
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
 
LVL 1

Expert Comment

by:Oli2
ID: 1343687
Hey, Zif !
Thanx for posting the code...
.took me some time to find this question again.
Now I've got it.

Greetings, Oli
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1343688
well, it was me that posted the code by the way ;-)

get some glasses bro' :))

-Viktor
--Ivanov
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now