Solved

TEdit on TToolBar

Posted on 2001-07-20
12
395 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

26 Experts available now in Live!

Get 1:1 Help Now