?
Solved

Very easy question...

Posted on 1999-12-10
14
Medium Priority
?
210 Views
Last Modified: 2010-04-06
Prevent user from resizing Form!
In D3 you selected Resizable bsNone but
in D5 ...where did it go?
Hate clicking so please a quick hint...
So in D5,how do you prevent user from resizing form?Ha...
0
Comment
Question by:Sendo
  • 3
  • 3
  • 2
  • +5
14 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2271381
hi sendo

adjust the constraints-property min and max of width and height to the same value

meikl
0
 
LVL 1

Expert Comment

by:nrico
ID: 2271513
I'm convinced: D5 sux! :-) (kidding)
0
 
LVL 1

Accepted Solution

by:
victor_christov earned 60 total points
ID: 2271522
hi sendo

Try BorderStyle := bsSingle ;

Victor
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
LVL 1

Expert Comment

by:nrico
ID: 2271524
In Delphi 4 it's "Borderstyle=bsSingle" instead of "bsResizable". I dunno if that is also the case in D5?
0
 
LVL 1

Expert Comment

by:nrico
ID: 2271527
Hey Victor, you answered it when I was still typing!! :-)
0
 
LVL 1

Expert Comment

by:samchan
ID: 2271807
{
IMHO, I believe the way I am doing it is much better although it takes a bit of work.
However, this way, I can have the form maximized properly whether there is or without
windows task bar. Besides, no problem will arise if users were to choose a different
screen resolution.
Hope this helps.

SA/\/\
}

type
  TfrmMain = class(TForm)
    { .....}
    procedure FormActivate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  Private
    done: Boolean;
    procedure WMWindowPosChanging(var Msg: TWMWindowPosChanging); Message WM_WindowPosChanging;
  Public
    { Public declarations }
  end;

{...}

implementation

procedure TfrmMain.FormActivate(Sender: TObject);
begin
  inherited;
  done := True;
end;

{ Window can be maximized the first time }
procedure TfrmMain.FormShow(Sender: TObject);
begin
  inherited;
  {...}
  WindowState := wsMaximized;
end;

{ This will prevent users from moving or resizing the desktop }
procedure TfrmMain.WMWindowPosChanging;
begin
  if done then
    Msg.WindowPos^.Flags := Msg.WindowPos^.Flags or SWP_NOMOVE or SWP_NOSIZE;
end;
0
 

Expert Comment

by:isasori
ID: 2271863
Try bsSingle (as Victor Says) and bsDialog
0
 

Author Comment

by:Sendo
ID: 2272153
Too much typing for a trivial thing.
I would rather have the user suffer!
Ha,ha,ha....
I will try Meikls and Vics sugg...
Tell ya later...
0
 
LVL 2

Expert Comment

by:florisb
ID: 2275108
Even more complete, but I should't get points for this, errrrh?

Use the help!

Oh help,
Floris

Specifies the appearance and behavior of the form border.

property BorderStyle: TFormBorderStyle;

Description

Use BorderStyle to get or set the appearance and behavior of the form border. BorderStyle can be any of the following TFormBorderStyle values:

Value      Meaning

bsDialog      Not resizeable; standard dialog box border
bsSingle      Not resizeable; single-line border
bsNone      Not resizeable; no visible border line
bsSizeable      Standard resizeable border
bsToolWindow      like bsSingle but with a smaller caption
bsSizeToolWin      like bsSizeable with a smaller caption

Note:      Changing the border style of an MDI child form to bsDialog or bsNone has no effect.
0
 

Expert Comment

by:WMPeters
ID: 2279930
Okay, Sendo

You're right, easy question, so this one requires an easy answer: Two solutions.


#1

In Delhpi 5 (Enterprise):

In the Object Inspector, choose by the property BorderStyle for the option bsDialog. Now the user can not change the formsize anymore

#2

Install the LMD components, which came as a special edition for Delphi 5 and can be found on the same CD-Rom. Choose for the tab LMD SYS in the component table. Choose for the fourth element of this tab, being the element LMD-FORM. In the object inspector you can define more detailed properties for the form, also the max an min size of this form. Make those two value's the same, and you're there. TIP. When using non-visual compnents, you can make the form large while editing, once started, the form wil be reduced to the value's given bij the max and min items.

If you did not install these components yet, do so. They are exceptional good. You can also download a (unlimited) trial version at www.lmd.de

Success
0
 

Expert Comment

by:WMPeters
ID: 2279950
By the way, forgot to add to the question (to fast to answer, sorry):

If you ad the line:
ShowWindow(Application.Handle,SW_HIDE);
then you also remove the button in the taskbar, and thereby another way to use Minimize and Maximize.

0
 
LVL 2

Expert Comment

by:florisb
ID: 2282833
ShowWindow(application.handle, SW_HIDE);
ShowWindow(FindWindow(nil, @Application.Title[1]), SW_HIDE);

In the application.activate event. Hides it a bit more...
0
 

Author Comment

by:Sendo
ID: 2304843
Sorry ...
"In the Object Inspector, choose by the property BorderStyle for the option bsDialog. Now the user can not change the formsize anymore "
This option prevents user from Max/Min the form and that is not what I want...
Using bsSingle does the trick...
so the points to Victor !
Meikl also had a good point....
Well I guess Vic answered it first (or no?)
Ok,Vic

0
 

Author Comment

by:Sendo
ID: 2304844
Sorry ...
"In the Object Inspector, choose by the property BorderStyle for the option bsDialog. Now the user can not change the formsize anymore "
This option prevents user from Max/Min the form and that is not what I want...
Using bsSingle does the trick...
so the points to Victor !
Meikl also had a good point....
Well I guess Vic answered it first (or no?)
Ok,Vic

0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

600 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