?
Solved

Why is this not working (frames) ???

Posted on 2008-11-03
40
Medium Priority
?
652 Views
Last Modified: 2011-10-19
Two panels on a form.On panel1 two buttons-panel2 is for showing frames:
The code:

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, dxsbar, dxGDIPlusClasses, ImgList, StdCtrls;
type
TFrames = (Frame2, Frame3);
    TForm1 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
  Frame2, Frame3 : TFrame;
  fActiveFrame: TFrames;
  procedure SetActiveFrame(const Value: TFrames);
  { Private declarations }
  public
  property ActiveFrame : TFrames read fActiveFrame write SetActiveFrame;
 { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
Uses Unit2,Unit3;
procedure TForm1.SetActiveFrame(const Value: TFrames);
var
  LastFrame : TFrames;
 begin
  if fActiveFrame <> Value then
    begin
      LastFrame := fActiveFrame;
      fActiveFrame := Value;
            case LastFrame of
        Frame2 : Frame2.Parent := nil;
        Frame3 : Frame3.Parent := nil;
      end;
      case fActiveFrame of
        Frame2 : Frame2.Parent := Panel2;
        Frame3 : Frame3.Parent := Panel2;
      end;
    end;
    end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Frame2 := TFrame.Create(nil);
Frame3 := TFrame.Create(nil);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeAndNil(Frame2);
FreeAndNil(Frame3);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ActiveFrame := Frame2;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ActiveFrame := Frame3;
end;
end.


I get :
[Error] Unit1.pas(51): Constant expression expected
[Error] Unit1.pas(81): Incompatible types: 'TFrames' and 'TFrame'
0
Comment
Question by:senad
  • 23
  • 13
  • 2
  • +1
39 Comments
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22874125
try this

ps you don't need to declare TFrames

just fActiveFrame: TFrame;
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, dxsbar, dxGDIPlusClasses, ImgList, StdCtrls;
type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    Frame2: TFrame;
    Frame3: TFrame;
    fActiveFrame: TFrame;
    procedure SetActiveFrame(const Value: TFrame);
  public
    property ActiveFrame: TFrame read fActiveFrame write SetActiveFrame;
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
Uses Unit2,Unit3;
procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrames;
begin
  if fActiveFrame <> Value then
  begin
    LastFrame := fActiveFrame;
    fActiveFrame := Value;
    LastFrame.Parent := nil;
    fActiveFrame.Parent := Panel2;
  end;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame.Create(nil);
  Frame3 := TFrame.Create(nil);
end;
 
procedure TForm1.FormDestroy(Sender: TObject);
begin
  FreeAndNil(Frame2);
  FreeAndNil(Frame3);
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
ActiveFrame := Frame2;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ActiveFrame := Frame3;
end;
end.

Open in new window

0
 
LVL 17

Expert Comment

by:mokule
ID: 22874188
no const needed here I think
procedure SetActiveFrame(const Value: TFrame);
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22874199
that line is created automaticly by Delphi after hitting Ctrl-Shift C with class completion
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 15

Expert Comment

by:mikelittlewood
ID: 22874524
Always wonder why delphi does that because it is strictly incorrect.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22878759
i believe it's for the interfaces
when you pass a interface to a procedure and don't use const
the interface gets nil'ed

so they got lazey and added const to every property getter/setter
0
 
LVL 22

Author Comment

by:senad
ID: 22887251
Geert_Gruwez:
I copy&pasted your example and  compiler gave me error:
[Error] Unit1.pas(32): Undeclared identifier: 'TFrames'
[Error] Unit1.pas(38): Missing operator or semicolon
[Fatal Error] Project1.dpr(7): Could not compile used unit 'Unit1.pas'


It stopped on :
procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrames;  ..........
0
 
LVL 17

Accepted Solution

by:
mokule earned 900 total points
ID: 22888035
should be
var
  LastFrame : TFrame;
0
 
LVL 22

Author Comment

by:senad
ID: 22892331
Mokule
I got a nasty crash (debugger notification) on compiling this one.
 It died on :
 LastFrame.Parent := nil;

The code:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, dxsbar, dxGDIPlusClasses, ImgList, StdCtrls;
type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    Frame2: TFrame;
    Frame3: TFrame;
    fActiveFrame: TFrame;
    procedure SetActiveFrame(const Value: TFrame);
  public
    property ActiveFrame: TFrame read fActiveFrame write SetActiveFrame;
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}

Uses Unit2,Unit3;

procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrame;
begin
  if fActiveFrame <> Value then
  begin
    LastFrame := fActiveFrame;
    fActiveFrame := Value;
    LastFrame.Parent := nil;
    fActiveFrame.Parent := Panel2;
  end;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame.Create(nil);
  Frame3 := TFrame.Create(nil);
end;
 
procedure TForm1.FormDestroy(Sender: TObject);
begin
  FreeAndNil(Frame2);
  FreeAndNil(Frame3);
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
ActiveFrame := Frame2;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ActiveFrame := Frame3;
end;
end.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22892507
procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrame;
begin
  if fActiveFrame <> Value then
  begin
    LastFrame := fActiveFrame;
    fActiveFrame := Value;
    if LastFrame <> nil then
      LastFrame.Parent := nil;
    fActiveFrame.Parent := Panel2;
  end;
end;
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22892511
probably this too:

procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrame;
begin
  if fActiveFrame <> Value then
  begin
    LastFrame := fActiveFrame;
    fActiveFrame := Value;
    if LastFrame <> nil then
      LastFrame.Parent := nil;
    if fActiveFrame <> nil then
      fActiveFrame.Parent := Panel2;
  end;
end;
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22892514
this is the same behaviour you want as ActiveControl
the form which has focus is in ActiveControl
0
 
LVL 22

Author Comment

by:senad
ID: 22892766
Frames not showing !?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22893294
Frames not showing ?!

would you care to explain ?
somehow there are some more lines missing with more clarification as what you mean :)
0
 
LVL 22

Author Comment

by:senad
ID: 22893536
Clicking on the either button does not display the frame.
If I click button one ,there should be Frame2 showing on Panel2.
If I click button two ,there should be Frame3 showing on Panel2.
It does not do anything now :-)


0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22893543
what about not checking for
fActiveFrame <> Value

procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrame;
begin
  LastFrame := fActiveFrame;
  fActiveFrame := Value;
  if LastFrame <> nil then
    LastFrame.Parent := nil;
  if fActiveFrame <> nil then
    fActiveFrame.Parent := Panel2;
end;
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22893547
and why not

procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame.Create(Self);
  Frame3 := TFrame.Create(Self);
end;
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22893552
the you can delete

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FreeAndNil(Frame2);
  FreeAndNil(Frame3);
end;
0
 
LVL 22

Author Comment

by:senad
ID: 22894770
Did you try and compile this?
Please try and let me know if it works for you...
To me it does not.
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22895884
I typed this in the browser
never opened Delphi to create this

i'll do it now :D

0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22896036
I recreated an example of this myself

started from scratch
the result is in the snippet :

the differences you still need for your code
is that you are using TFrame
and none of the descendants you created in Unit2 and Unit3
you are displaying empty, clean, transparent frames !

procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame.Create(nil);
  Frame3 := TFrame.Create(nil);
end;

should be

procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame2.Create(Self);
  Frame3 := TFrame3.Create(Self);
end;

if the frames are called TFrame2 and TFrame3 off course !

I thought you were still going to adjust this
I guessed wrong

unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Panel1: TPanel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    fActiveFrame: TFrame;
    fFrame2: TFrame;
    fFrame3: TFrame;
    function GetFrame2: TFrame;
    function GetFrame3: TFrame;
    procedure SetActiveFrame(const Value: TFrame);
  public
    constructor Create(AOwner: TComponent); override;
    property DisplayFrame2: TFrame read GetFrame2;
    property DisplayFrame3: TFrame read GetFrame3;
    property ActiveFrame: TFrame read fActiveFrame write SetActiveFrame;
 
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
{ TForm1 }
 
constructor TForm1.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  fActiveFrame := nil;
  fFrame2 := nil;
  fFrame3 := nil;
end;
 
function TForm1.GetFrame2: TFrame;
begin
  if not Assigned(fFrame2) then
  begin
    fFrame2 := TFrame.Create(Self);
    fFrame2.Color := clGreen;
  end;
  Result := fFrame2;
end;
 
function TForm1.GetFrame3: TFrame;
begin
  if not Assigned(fFrame3) then
  begin
    fFrame3 := TFrame.Create(Self);
    fFrame3.Color := clRed;
    fFrame3.Align := alClient;
    with TLabel.Create(fFrame3) do
    begin
      Caption := 'Frame3';
      Top := 20;
      Left := 20;
      Parent := fFrame3;
    end;
  end;
  Result := fFrame3;
end;
 
procedure TForm1.SetActiveFrame(const Value: TFrame);
var LastFrame: TFrame;
begin
  LastFrame := fActiveFrame;
  if Assigned(LastFrame) then
    LastFrame.Parent := nil;
  fActiveFrame := Value;
  if Assigned(fActiveFrame) then
    fActiveFrame.Parent := Panel1;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  ActiveFrame := DisplayFrame2;
end;
 
procedure TForm1.Button2Click(Sender: TObject);
begin
  ActiveFrame := DisplayFrame3;
end;
 
end.

Open in new window

0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22896088
why my own example ?

yours wouldn't compile as I don't have all DevExpress modules
in particular dxGDIPlusClasses
0
 
LVL 22

Author Comment

by:senad
ID: 22901942
Nothing from devexpress here...Two panels,two frames and two butttons...
dx.. was a leftover and was taken out.
0
 
LVL 22

Author Comment

by:senad
ID: 22901997
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button2: TButton;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
fActiveFrame: TFrame;
Frame2: TFrame;
Frame3: TFrame;
function GetFrame2: TFrame;
function GetFrame3: TFrame;
procedure SetActiveFrame(const Value: TFrame);
public
constructor Create(AOwner: TComponent); override;
property DisplayFrame2: TFrame read GetFrame2;
property DisplayFrame3: TFrame read GetFrame3;
property ActiveFrame: TFrame read fActiveFrame write SetActiveFrame;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
constructor TForm1.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fActiveFrame := nil;
Frame2 := nil;
Frame3 := nil;
end;

function TForm1.GetFrame2: TFrame;
begin
if not Assigned(Frame2) then
begin
Frame2 := TFrame.Create(Self);
Frame2.Color := clGreen;
Frame2.Align := alClient;
end;
Result := Frame2;
end;

function TForm1.GetFrame3: TFrame;
begin
if not Assigned(Frame3) then
begin
Frame3 := TFrame.Create(Self);
Frame3.Color := clRed;
Frame3.Align := alClient;
end;
Result := Frame3;
end;

procedure TForm1.SetActiveFrame(const Value: TFrame);
var LastFrame: TFrame;
begin
LastFrame := fActiveFrame;
if Assigned(LastFrame) then
LastFrame.Parent := nil;
fActiveFrame := Value;
if Assigned(fActiveFrame) then
fActiveFrame.Parent := Panel1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ActiveFrame := DisplayFrame2;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ActiveFrame := DisplayFrame3;
end;

end.
Why do you see a flicker of white on panel1 when clicking buttons??
 
"and none of the descendants you created in Unit2 and Unit3
you are displaying empty, clean, transparent frames !"
correct but >
procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame2.Create(Self);
  Frame3 := TFrame3.Create(Self);
end;
 does not do the trick... So what should the code (myone)be?
Little tiring doing functions for each frame...
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22902416
Little tiring doing functions for each frame... ?
Then stop programming !
Have you ever condisdered resources like memory ?
If nobody ever pushes Button2 in my example then TFrame3 never gets created (or memory consumed)
But then again, why would you care, you're too tired !
Programming is not only typing (or copy/paste) some text, it's an art !

It's delving in to problems, finding how it works, looking up solutions, reading the help.
And not giving up.

I copied your example and everything works fine !
Have you looked at every piece of code carefully ?
Didn't you miss a single character ?

If you want to see with your own eyes then come over here at my desk and check
I'll even add a screen shot and the whole code, dfm's included, using your example

May the source be with you
Cause i'm nearly giving up

unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Panel2: TPanel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    Frame2: TFrame;
    Frame3: TFrame;
    fActiveFrame: TFrame;
    procedure SetActiveFrame(const Value: TFrame);
  public
    property ActiveFrame: TFrame read fActiveFrame write SetActiveFrame;
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
Uses Unit2,Unit3;
 
procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrame;
begin
  LastFrame := fActiveFrame;
  fActiveFrame := Value;
  if Assigned(LastFrame) then
    LastFrame.Parent := nil;
  if Assigned(fActiveFrame) then
    fActiveFrame.Parent := Panel2;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame2.Create(Self);
  Frame3 := TFrame3.Create(Self);
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  ActiveFrame := Frame2;
end;
 
procedure TForm1.Button2Click(Sender: TObject);
begin
  ActiveFrame := Frame3;
end;
 
end.
 
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;
 
type
  TFrame2 = class(TFrame)
    Panel1: TPanel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
implementation
 
{$R *.dfm}
 
end.
 
unit Unit3;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls;
 
type
  TFrame3 = class(TFrame)
    ListBox1: TListBox;
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
implementation
 
{$R *.dfm}
 
end.
 
object Form1: TForm1
  Left = 192
  Top = 160
  Width = 870
  Height = 640
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 45
    Top = 25
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 45
    Top = 65
    Width = 75
    Height = 25
    Caption = 'Button2'
    TabOrder = 1
    OnClick = Button2Click
  end
  object Panel2: TPanel
    Left = 60
    Top = 115
    Width = 586
    Height = 361
    Caption = 'Panel2'
    TabOrder = 2
  end
end
 
object Frame2: TFrame2
  Left = 0
  Top = 0
  Width = 320
  Height = 240
  TabOrder = 0
  object Panel1: TPanel
    Left = 55
    Top = 35
    Width = 196
    Height = 136
    Caption = 'Panel1'
    Color = clRed
    TabOrder = 0
  end
end
 
object Frame3: TFrame3
  Left = 0
  Top = 0
  Width = 320
  Height = 240
  TabOrder = 0
  object ListBox1: TListBox
    Left = 35
    Top = 40
    Width = 236
    Height = 161
    Color = clLime
    ItemHeight = 13
    TabOrder = 0
  end
end

Open in new window

screenshot.png
0
 
LVL 22

Author Comment

by:senad
ID: 22902520
Sorry to disapoint you but it does not work.

unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Panel2: TPanel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    Frame2: TFrame;
    Frame3: TFrame;
    fActiveFrame: TFrame;
    procedure SetActiveFrame(const Value: TFrame);
  public
    property ActiveFrame: TFrame read fActiveFrame write SetActiveFrame;
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
Uses Unit2,Unit3;
 
procedure TForm1.SetActiveFrame(const Value: TFrame);
var
  LastFrame : TFrame;
begin
  LastFrame := fActiveFrame;
  fActiveFrame := Value;
  if Assigned(LastFrame) then
    LastFrame.Parent := nil;
  if Assigned(fActiveFrame) then
    fActiveFrame.Parent := Panel2;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Frame2 := TFrame2.Create(Self);
  Frame3 := TFrame3.Create(Self);
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  ActiveFrame := Frame2;
end;
 
procedure TForm1.Button2Click(Sender: TObject);
begin
  ActiveFrame := Frame3;
end;
 
end.

Open in new window

0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22902527
did you actually try all my code ?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22902535
now and then somme funny things happen

Like me giving up on this

Have you seen Achmed, The Dead Terrorist ?
I'm not yelling at my screen the famous words !
"Silence, I ..."
0
 
LVL 22

Author Comment

by:senad
ID: 22912072


Of course I tried....
(by the way,in your nice picture,what's a panel doing on a frame ?)
Ahmed is lucky...I am banging my head on the monitor asking myself how comes it works for him and not for me?.
'resources like memory ' ...you really miss the old DOS days,aren't you??
Did you try and compile my code,actually?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22921760
what's a panel doing on a frame ?

you can design frames any which way you like
you can put a lot of components on a panel
(just like a form actually)

when you right click on the Frame in the Frame/Form Editor
you have the menu option "Add to component palette"
This puts the Frame and *all* it's components on the component palette

When you open a new form, click on the just created component
in the component palette and then click in you form
you will have the frame and all it's components in this new form

How did you think frames were being used ?
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22921766
I can't compile your code !!!

I don't have units 2 and 3 !!!
0
 
LVL 22

Author Comment

by:senad
ID: 22929462
Well.to get those units use "New" - "New Frame"  :-)
Once you get them please do (and I mean :do) trie and compile.
No more pictures,please...
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22959128
i'm not the novice at Delphi here.
if you can't get it to work, i'll be happy to come over and show what yer doing wrong
you just need to mail me the airplane ticket, cab fare and hotel fare for 1 night.

I posted you a complete working sample.
If you can't get this sample to work then there is no point to continue.

The pictures were proof it actually works.





0
 
LVL 22

Author Comment

by:senad
ID: 22962017
The question was why my code does not work,not yours...
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22966136
Your code doesn't work because something is obviously wrong with it.
That's why i gave you a *working* example.
You can use it to start and copy your code into it.

Go 1 step/event/procedure at a time, untill you get to the error.
0
 
LVL 22

Author Comment

by:senad
ID: 23062563
No,this is not it...
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23066649
senad, I'm giving up on you and frames.
I tried explaining with hands, feet, face, everything.
Obviously you just don't grasp it, do you ?

put you project in .zip, put it on EE-stuff and people can take a look at it.

You're not gonna get any further like this !
0
 
LVL 22

Author Comment

by:senad
ID: 23066847
That first code was not my code anyway...I found it posted somewhere...dont remember where...
It seemed to me a good idea (so you do not have to do a 'frame.hide and frame.show stuff)
Tried it and it dont seem to work.That is why I tried to have some help with that very same code (in case I was doing something wrong).Since I am a noobie in programming I allways try and find something new,to discover how things work.
As for the frames,I think I am going to give up on them to...Seems a nice idea at first but the more you get into them the more limitations you find.(Also found a nice example at codegear how to put frames on tab control).All in all I found it to be the best practice to use forms.


0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23066853
frame have some pitfalls, especially when modifying the ancestor and deleting controls
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 23083756
well, maybe but the question has been answered.
Because of all the effort i put into this, i object to deletion
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 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