TEdit on TToolBar

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
LVL 2
omsecAsked:
Who is Participating?
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
omsecAuthor Commented:
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
 
Mohammed NasmanSoftware DeveloperCommented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
bugrogerCommented:
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
 
bugrogerCommented:
mnasman,
 You was faster.
 I saw your code after i have submitted my comment :(

 

0
 
Mohammed NasmanSoftware DeveloperCommented:
don't worry bugroger, that's happen to me alot :)
0
 
tearsoftragedyCommented:
Hey Omsec!!....

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

0
 
omsecAuthor Commented:
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
 
bugrogerCommented:
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
 
MoondancerCommented:
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
 
Russell LibbySoftware Engineer, Advisory Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.