Solved

TEdit on TToolBar

Posted on 2001-07-20
12
397 Views
Last Modified: 2010-04-06
Hello out there,

I'm having a problem that currently is behind my horizont.

Maybe it's simple for you ;-)

As you can see on the picture at http://www.omsec.com/problem.jpg I am dealing with a normal TEdit-Box on a TToolBar-Menu. I have several buttons on the left of the ToolBar and now I'd like to fill up the remaining Space on the right with the TEdit-Box, also when the Size of the Form changes.

Any Ideas ?

Cheers, Roger
0
Comment
Question by:omsec
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 2

Author Comment

by:omsec
ID: 6303456
sorry
the correct URL is http://www.omsec.com/problem.gif

...the TEdit should behave like it has an Align-Property (which isn't present in D5 ENT)
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6303473
your link not work, try to put the right link plz
I don't know what's the problem with put editbox in the toolbar?

  if you want to add editbox into the toolbar at the run time, you can do that simply

 Edit1.Parent := ToolBar1;

maybe i don't understand you well, so i'm waiting for the right link

Mohammed
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 50 total points
ID: 6303502
Hello

  Do you mean you want all the space after the buttons to fill with the Edit box?

 if that what you mean at this code onresize event

procedure TForm1.FormResize(Sender: TObject);
begin
  Edit1.Width := Toolbar1.width - Edit1.Left;
end;

Best regards
Mohammed Nasman
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 2

Assisted Solution

by:bugroger
bugroger earned 50 total points
ID: 6303518
Hi omsec,

Try This:

Set these code in your form-resize event.
Maybe you must change the Edit and the Toolbar name.

 Edit1.Width := ToolBar1.Width - Edit1.Left;

GL
 BUG
0
 
LVL 2

Expert Comment

by:bugroger
ID: 6303529
mnasman,
 You was faster.
 I saw your code after i have submitted my comment :(

 

0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6303570
don't worry bugroger, that's happen to me alot :)
0
 

Expert Comment

by:tearsoftragedy
ID: 6304437
Hey Omsec!!....

it's almost the same code i gave you in the #delphi channel... hehehe... i though you were happy with it...

0
 
LVL 2

Author Comment

by:omsec
ID: 6316513
lol, i wonder....

but this doesn't behave as expected. When I maximize the form and then minimize it, the Edit suddenly fills the entire ToolBar and the Buttons can't be reached anymore, unless the application is restarted....
0
 
LVL 2

Expert Comment

by:bugroger
ID: 6317434
If i maximize the form and then minimize it
the edit "does not" fill the entire ToolBar.

Here is my code:

//--------------------------------------------------------
unit TB;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ToolWin, ComCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    ToolBar1: TToolBar;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure FormResize(Sender: TObject);
    procedure ToolBar1Resize(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormResize(Sender: TObject);
begin
 Edit1.Width := ToolBar1.Width - Edit1.Left;
end;

procedure TForm1.ToolBar1Resize(Sender: TObject);
begin
// Edit1.Width := ToolBar1.Width - Edit1.Left;
end;

end.
//------------------------------------------------------

//=============== DFM ==================================
object Form1: TForm1
  Left = 197
  Top = 168
  Width = 547
  Height = 369
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnResize = FormResize
  PixelsPerInch = 96
  TextHeight = 13
  object ToolBar1: TToolBar
    Left = 0
    Top = 0
    Width = 539
    Height = 29
    ButtonHeight = 21
    Caption = 'ToolBar1'
    TabOrder = 0
    object Button1: TButton
      Left = 0
      Top = 2
      Width = 75
      Height = 21
      Caption = 'Button1'
      TabOrder = 1
    end
    object Button2: TButton
      Left = 75
      Top = 2
      Width = 75
      Height = 21
      Caption = 'Button2'
      TabOrder = 2
    end
    object Edit1: TEdit
      Left = 150
      Top = 2
      Width = 386
      Height = 21
      AutoSize = False
      TabOrder = 0
      Text = 'Edit1'
    end
  end
end

//=============== DFM ==================================

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6908047
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> You cannot delete a question with comments, special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process for further information, if needed.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11896578.html
http://www.experts-exchange.com/questions/Q.20109588.html
http://www.experts-exchange.com/questions/Q.20154494.html
http://www.experts-exchange.com/questions/Q.20156716.html
http://www.experts-exchange.com/questions/Q.20237072.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20236974.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8711181
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To split points between bugroger and mnasman

Note:
Both the Form and Toolbar resize events must be coded to handle the setting of the edit width to work correctly, thus the reason for the split.

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

825 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