[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

HELP!!! Problems with Edit Control!! urgent!!

Posted on 1999-01-12
2
Medium Priority
?
178 Views
Last Modified: 2010-04-06
Hi all!!!

I have the following problem.... my main form has a lot of Edit controls... some of them are 22 units width (which accept 2 characters), and others 14 units (which accept 1 character). The font used is Courier New, 8 pts. The problem I have only with the Edit controls 14 units width. In my PC the text I want to display is shown correctly but only in the 1024x768x32 resolution (in other resolutions the controls appear in blank). When I ran the program in other PC, it was impossible for me to make the control show the text properly (the controls appear in blank again). I realized that the text is there, but too left justified, so the control doesn't show it. To make it work, I have to change either the width (to 21 units at least) or the font (small font, 7 pts, only).

What the hell can I do!!!!!! I HAVE to use Courier New font and that width. Is it a control problem? windows problem? If I would install a new edit control, would I solve the problem? where can I download a new one?

THANKS a lot in advance
Jaime
0
Comment
Question by:skel
[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
2 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 280 total points
ID: 1356118
The problem lies in that the font size is fixed number of points (where one point = 1/72 inches) and the number of screen pixels taken by a character of a fixed point size depends on the physical dots per inch of the particular screen resolution.

Effectively your only solution is to modify the point size, or to force the form to scale with changes in resolution.

Here is a component that will do this (written by Viktornet I believe...):

unit Scaler;

         interface

         uses
           Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms,
         Dialogs;
         const
            ScreenWidth  : Integer = 800; //If you don't want to declare

    constants
                                         //you'd have to have a
            ScreenHeight : Integer = 600;//property for each of these
two so
    you can
        // declare it at //designtime
         type
           TScaler = class(TComponent)
           private
             FAllScaled : Boolean;
           protected
             { Protected declarations }
           public
             constructor Create(AOwner : TComponent);override;
             procedure Loaded;override;
           published
             { Published declarations }
           end;
         procedure Register;
         implementation
    constructor TScaler.Create(AOwner : TComponent);
    begin
      Inherited Create(AOwner);
      fAllScaled := False;
    end;
    procedure TScaler.Loaded;
    begin
      Inherited;
      if not(csDesigning in ComponentState) then
        if Owner is TForm then
        with TForm(Owner) do begin
          Font.Pitch := fpVariable;
          if (not
fAllScaled)and((Screen.Width<>ScreenWidth)or(Screen.Height<>ScreenHeight))then

           begin
             Scaled := True;
             AutoScroll := False;
              if Screen.Width < ScreenWidth then
             ScaleBy(Screen.Width, ScreenWidth)
             else ScaleBy(ScreenWidth, Screen.Width);
             fAllScaled := True;
           end;
         end;
    end;
    procedure Register;
    begin
      RegisterComponents('System', [TScaler]);
    end;
    end.


0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1356119
Instead of hard wiring 14, why not (in FormCreate) set the width property of the edit control to [YourForm.]Canvas.TextWidth('A');

You might like to add another 3 or 4 pixels to account for the edit's border maybe.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 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