Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Which component to use to make a terminal-emulation programm

Posted on 2006-07-02
10
Medium Priority
?
302 Views
Last Modified: 2010-04-05
HI Experts,

I need your advice?

I want to make a Terminal-Emulation programm.

Which existing-component can I use best to put on the form.
or is it possible to use the canvas of the form itself ?

But whatever the advice is, it has to do the following:

When the user resizes the form, the component
has to resize with it.

Offcourse, examples are very welcom.

Greetings,

Peter Kiers
0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 17028064
Is this for connecting to terminal services, or your own custom method?
0
 
LVL 3

Expert Comment

by:Ubethatway
ID: 17028665
If you simply want to make a command-line app, you dont need any components, it is just a certain type of delphi application. The you could simply execute it from the command line and all your output would be through the standard commandline for the OS...

If you specifically wish to run the app in a window, then i think the Memo component will possibly meet your requirements, but you may need to write a bit of code to get it behaving the way you want, scrolling etc...

To get it to resize with the window all you should need to do is set its anchor and resize properties to what you need.

Hope that helps, Mark
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17029614
Hi,

Thank you for all the reactions.

The question from TheRealLoki is dont understand, forgive me
i am Dutch, my English is very bad.

andf for Ubethatway: No, it's not a command-line app.

My problem:

I have found a terminal-emulation programm on the internet that uses
a TImage for displaying the output receiving from the host.

It works fine, only there is one thing I'm not sadisfied:
When the user resizes the form, the TImage does not resize with it.

Is there a way to fix that, or is there a better way, maybe
by using another component, or use the canvas of the form itself.

greetings,

Peter Kiers
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:Ubethatway
ID: 17029902
Hi,

I believe that you should simply be able to change the properties of the TImage component to get it to rersize with the form. I don't have access to a copy of Delphi atm, so i cant give you the exact name of the property you need to change, but theres a property which has a value that ends in ???client...that should set the Timage to be the full size of the orm canvas. Just play around with the properties that control how the component is displayed and you should find an answer.

Sorry i couldnt be more specific, Mark.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17030063

mmm, i think i am thinking wrong.

Because when the user changes the font to a bigger font the screen gets bigger.

Is it perhaps possible to programm in the resize-event of the Timage
that when the user resizes the form the font increase / decreases with it.

This is the procedure for changing font:

procedure Tscreenf.ChangeFont1Click(Sender: TObject);
var
  TxMetric: TTextMetric ;
begin
  FontDialog1.Font := ScrImage1.Canvas.Font ;
  if FontDialog1.Execute() then
    begin
      ScrImage1.Canvas.Font := FontDialog1.Font ;
      FontSize := ScrImage1.Canvas.Font.Size ;
      FontName := ScrImage1.Canvas.Font.Name ;

      { get the cell size based on the current font, calculate and set }
      { the client window size and the image area size }
      GetTextMetrics(ScrImage1.Canvas.Handle,TxMetric) ;
      FontWidthPix := TxMetric.tmMaxCharWidth ;
      FontHeightPix := TxMetric.tmHeight ;
      ScrImage1.Picture.Graphic.Height := SCRROWS * FontHeightPix
        + (FontHeightPix+2) ;
      ScrImage1.Picture.Graphic.Width := SCRCOLS * FontWidthPix ;

      { set client area after image size has been set }
      ClientHeight := SCRROWS * FontHeightPix + (FontHeightPix+2) ;
      ClientWidth := SCRCOLS * FontWidthPix ;

      { re-show the current screen }
      ShowBuf ;
    end  ;
end;

procedure Tscreenf.FormCreate(Sender: TObject);
var
  TxMetric: TTextMetric ;
  Bitmap: TBitmap ;
begin
   
  SCRCOLS := 80 ;
   SCRROWS := 24 ;
 
  { get the cell size based on the current font, calculate and set }
  { the client window size and the image area size }
  Bitmap := TBitmap.Create ;
  ScrImage1.Canvas.Font.Size := FontSize ;
  ScrImage1.Canvas.Font.Name := FontName ;
  GetTextMetrics(ScrImage1.Canvas.Handle,TxMetric) ;
  FontWidthPix := TxMetric.tmMaxCharWidth ;
  FontHeightPix := TxMetric.tmHeight ;
  Bitmap.Height := SCRROWS * FontHeightPix + (FontHeightPix+2) ;
  Bitmap.Width := SCRCOLS * FontWidthPix ;
  ScrImage1.Picture.Graphic := Bitmap ;
  ScrImage1.Canvas.Font.Size := FontSize ;
  ScrImage1.Canvas.Font.Name := FontName ;

  { set client area after image size has been set }
  ClientHeight := SCRROWS * FontHeightPix + (FontHeightPix+2) ;
  ClientWidth := SCRCOLS * FontWidthPix ;

  { create and show the initial screen }
  ClearBuf ;
  ShowBuf ;
end;

procedure Tscreenf.FormResize(Sender: TObject);
var
  TxMetric: TTextMetric ;
begin
  ClientHeight := SCRROWS * FontHeightPix + (FontHeightPix+2);
  ClientWidth := SCRCOLS * FontWidthPix ;
end;

Peter K.
0
 
LVL 11

Expert Comment

by:calinutz
ID: 17030169
You should give us the link to that terminal-emulation programm on the internet that uses
a TImage for displaying the output receiving from the host.

This way we could analyze the source code and give you a more accurate answer

Regards
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17031519
I have put it on my site:

http://members.home.nl/peterkiers/

Click on download and you see the ZQJEme32703.zip

P.
0
 
LVL 3

Expert Comment

by:Ubethatway
ID: 17034658
OK, the way to do this is to set the "Align" property of the component to "alClient", then set the "stretch" property of the TImage component to "true". The image will then be the full size of the client area whenever the form is resized.

Mark
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17035730
When you do that, the font wil be stretched too, then the font
will be misformed.

I like your idea, but what can we do about the font.
maybe in de resize-event!

Peter.
0
 
LVL 3

Accepted Solution

by:
Ubethatway earned 1500 total points
ID: 17035880
the simplest way to do it would be to change the font size to something more suitable on the form resize event:

procedure Tscreenf.FormResize(Sender: TObject);
var
  TxMetric: TTextMetric ;
begin
// CHANGE FONT PROCEDURE GOES HERE

//  ClientHeight := SCRROWS * FontHeightPix + (FontHeightPix+2);
//  ClientWidth := SCRCOLS * FontWidthPix ;
end;

You will need to work out a more suitable font size based on the height/width of the form (i.e. the values of ClientHeight & ClientWidth).

You can the either change to the new font, and leave it at that...or change to the new font and resize the form back to the propper proportions based on the original specs (i.e leave the two original lines in the resize procedure)

Mark
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

722 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