At runtime, the application is not the full size of the screen, but the
"Maximize/Restore" system button is in the maximized state, and the form is
in the top left of the screen.
i've also tried setting my application's main form to:
Positoin = poDefault
WindowState = wsNormal
And then OnCreate
Self.WindowState := wsMaximized;
i'e also tried setting OnShow
Self.WindowState := wsMaxmized;
i've also tried OnCreate
Self.Left := Self.Left + 10;
Self.Top := Self.Top + 10;
Self.WindowState := wsMaxmized;
i've also tried OnCreate
Self.WindowState := wsNormal;
and then OnShow
Self.WindowState := wsMaximized;
i've also tried setting my application's main form to
WindowState = wsMaxmimized;
and then OnCreate
Self.WindowState := wsNormal;
Self.WindowState := wsMaximized;
i've also tried OnCreate
Self.WindowState := wsNormal;
Self.WindowState := wsMaxmized;
Self.WindowState := wsNormal;
and then OnShow
Self.WindowState := wsMaximized;
Surely by now after years of dealing with the bug, there would a known,
accepted, tried and true, and implemented by Borland in Octane for Win32 a
fix to get my application's main form to appear maximized on startup.
See the attachments group for a screenshot of the symptom.
Andy
"Ian Boyd" <ian.borla...@avatopia.com> wrote in message
news:3faed18f$2...@newsgroups.borland.com...
i would think having constraints would be a bad thing. It might lead to my
form not maximizing. <g>
"Andy" <An...@no.mail.please> wrote in message
news:3faeee83$1...@newsgroups.borland.com...
In researching this problem, i saw a post where a guy was ridiculed pretty
heavily for using API function to try to get his form to behave. Peter Below
nicly explained that Delphi doesn't like you playing with it's forms behind
it's back.
But in this case, there may be no other way. So what's the way?
"Ian Boyd" <ian.borla...@avatopia.com> wrote in message
news:3faed18f$2...@newsgroups.borland.com...
>At design time i set my application's main form to:
> Position = poDefault
> WindowState = wsMaximized
>
>At runtime, the application is not the full size of the screen, but the
>"Maximize/Restore" system button is in the maximized state, and the form is
>in the top left of the screen.
I can't reproduce that, based on the description you gave. My form
comes up full screen (excluding the TaskBar, of course). What other
properties are different from the defaults? (Take a look at the form
in text mode to check for unusual stuff.)
Kurt
1. panel aligned left,
a) two panels aligned client
2. splitter aligned left
3. panel aligned client
a) panel aligned bottom
i. toolbar aligned bottom
b) panel aligned client
i. listview aligned client
ii. treeview aligned client
iii. VirtaulTreeView aligned client
iv. toolbar aligned top
etc etc
We get it all the time in our projects here. Eventually the VCL just doesn't
know how to handle the aligns anymore.
My question is: It's still a Windows window. Is there an accepted way in
Delphi to maximize the window?
"Kurt Barthelmess (TeamB)" <kbarth...@compuserve.com> wrote in message
news:3faf76ab....@newsgroups.borland.com...
>i'm sure it's not just the form. But some complex interaction between
>
>1. panel aligned left,
> a) two panels aligned client
>2. splitter aligned left
>3. panel aligned client
> a) panel aligned bottom
> i. toolbar aligned bottom
> b) panel aligned client
> i. listview aligned client
> ii. treeview aligned client
> iii. VirtaulTreeView aligned client
> iv. toolbar aligned top
>etc etc
Ouch. I don't think even I could figure out where to put something
under those conditions<g>.
>My question is: It's still a Windows window. Is there an accepted way in
>Delphi to maximize the window?
I don't see why setting the WindowState would not work. Except:
Because the relationships here are so complex, you may be getting into
some recursion or deadlock, and the VCL realizes (while trying to sort
all this out) that it is headed for a stack overflow. So it aborts the
process, which causes the changing of the WindowState to be aborted
also. That's just a SWAG, however.
You might try creating the window normally and then maximizing it with
the mouse. If that works, try setting WindowState after the initial
normal form creation process has completed.
Good luck.
Kurt
ok, not very helpfull, but...
I've got a simular layout with all the panels, splitters, toolbar,
frames with VirtualTreeViews, scrollboxes pageviews with
RichEdit, ListViews, etc, etc...
... and have no problems! Using D5/6/7 Win98/ME/2K/XP.
Are you sure it's the VCL and not some setting?
The form itself is set to poDesigned and wsNormal it's set to
wsMaximized in the OnShow.
The only way I can replicate your problem is when I set
AutoSize to True (although this should be False by default).
--
Pieter
i know it's the VCL just going insane, because i added some controls to a
child panel, and it started happening.
i remember a few years ago, the straw that did it was a label aligned top
inside a client panel. i worked around it by dropping a PaintBox instead of
a label, and painting the text myself.
i found a pseudo-decent fix.
public
FOneShot: Boolean;
procedure TForm1.FormCreate(Sender: TObject);
begin
FOneShot := True;
end;
procedure TForm1.OnShow(Sender: TObject);
begin
(* Nope, can't do it here. It has to be in OnActivate.
if FOneShot then
begin
FOneShot := False;
Self.WindowState := wsMaximized;
end;
Don't ask me why, i didn't make the broken rules, i only hack around
them
*)
end;
procedure TForm1.OnActivate(Sender: TObject);
begin
if FOneShot then
begin
FOneShot := False;
Self.WindowState := wsMaximized;
end;
end;
And Borland wonders why i want to use WinForms and never see VCL again...
"Pieter Zijlstra" <pzijl...@freeler.nl> wrote in message
news:3faff96d$1...@newsgroups.borland.com...
> i know it's the VCL just going insane, because i added some controls to a
> child panel, and it started happening.
>
> i remember a few years ago, the straw that did it was a label aligned top
> inside a client panel. i worked around it by dropping a PaintBox instead of
> a label, and painting the text myself.
I've never been really satisfied with Align-ing in anything but very simple
forms.
So for these I write in OnResize how I want everything to resize and
reposition, and in exactly what order I want it done.. Often when trying to
code it I realise that I don't actually *know* what I want under all
conditions and have to make decisions.. which might explain why the computer
couldn't guess right what I wanted.
Why a paintbox? .. just stretch the label to ClientWidth instead of relying
on align.
Does this mean you can reproduce it? If you remove the controls
the form will behave 'normal' again? Are these standard Delphi
controls you added to the child panel?
> procedure TForm1.OnActivate(Sender: TObject);
> begin
> if FOneShot then
> begin
> FOneShot := False;
> Self.WindowState := wsMaximized;
> end;
> end;
Just a side step, if this is the only thing you do in the
OnActivate you could also dump the extra var...
procedure TForm1.FormActivate(Sender: TObject);
begin
// Make sure this is only performed once.
OnActivate := nil;
....
end;
--
Pieter
i can reproduce it in the application i have sitting here.
If i were to strip it down to an empty form, i would not happen.
i'm sure if i strip down enough controls it will go away.
That doesn't mean that i'm doing anything specifically wrong, the VCL just
nuts in specific conditions.
> Just a side step, if this is the only thing you do in the
> OnActivate you could also dump the extra var...
i don't want that, because then every time the user went back to the form,
it would maxmize. It would be annoying if they already restored it and it
re-maximized itself. i only want it to happen when the form first loads up
(i.e. OnCreate or OnShow - if it worked)
i can't imagine having to write the code to resize and reposition all the
controls on the screen.
Besides, splitters require the use of an aligned control to resize.
> Why a paintbox? .. just stretch the label to ClientWidth instead of
relying
> on align.
Because of the panel aligned client below it.
?
That's reason of the above code: to prevent it from being called everytime
the user goes back to the form! By setting OnActivate to nil, FormActivate
will *never* be called again.
--
Pieter
i see what you were saying/doing now.
Sorry.
"Pieter Zijlstra" <pzijl...@freeler.nl> wrote in message
news:3fb5...@newsgroups.borland.com...
This bug exists from time when Borland was developed anchors system. As
solution of this problem, I'm using OnResize event, not a OnShow. In
combination with TCoolBar, ToolBar, two TListView, Splitter and StatusBar
( all components set for automaticaly maximum resizing ), with OnShow event
nightmare will become real again (at least form will not maximized, to
totaly chaos in ListView). Fixed in OnResize event, it is quite stabile:
------
var
FirstStart: boolean=true;
//......
procedure TForm1.FormResize(Sender: TObject);
begin
if FirstStart then
begin
WindowState:=wsMaximized;
FirstStart:=false
end
end;
------
Best regards,
Sasa
"Ian Boyd" <ian.borla...@zunblvlda1.dyndns.org.spamsucks> wrote in
message news:3fb0...@newsgroups.borland.com...