Solved

TSpinEdit looks like "compressed" on WinXP

Posted on 2003-12-11
14
287 Views
Last Modified: 2010-07-27
Please see this image:
http://home.i-cable.com/raymng/xp.jpg

This is a TSpinEdit running on WinXP, do you think the up/down arrow buttons
look like "compressed" ?  The buttons look good in other Windows, just WinXP... :-(

How can I fix this problem?

raymng
0
Comment
Question by:Raymond
  • 8
  • 5
14 Comments
 
LVL 8

Expert Comment

by:Cesario
ID: 9926595
Dear raymng,

I think the problem is in the Methode TSpinButton.AdjustSize in the unit Spin.pas.

procedure TSpinButton.AdjustSize (var W, H: Integer);
begin
 .......  
 if W < 15 then W := 15;
 .....
end;

solution:
try to detect the running operating system and if xp is running try to
to set

   IF W<13 then w := 13;

sorry but i have no XP running now :-(


good luck

Cesario

0
 

Author Comment

by:Raymond
ID: 9926700
Thanks Cesario!

Edit this file ?
C:\Program Files\Borland\Delphi7\Source\Samples\Spin.pas

0
 
LVL 8

Expert Comment

by:Cesario
ID: 9926726
right ;-)

you can copy this file to your project directory. Now you can change the code of this unit.

Best Regards

Cesario
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:Raymond
ID: 9926727
Also, it should not be the problem of W (Width), i think it is the problem of H (height).

raymng
0
 
LVL 8

Expert Comment

by:Cesario
ID: 9926753
sorry, i was to fast ;-)))

 FUpButton.SetBounds (0, 0, W, H div 2);
0
 
LVL 8

Expert Comment

by:Cesario
ID: 9926793
Ok the problem

procedure TSpinEdit.WMSize(var Message: TWMSize);
var
  MinHeight: Integer;
begin
   .........
   // Height -5  
    FButton.SetBounds(Width - FButton.Width - 5, 0, FButton.Width, Height - 5)
    else FButton.SetBounds (Width - FButton.Width, 1, FButton.Width, Height - 3);
    SetEditRect;
  end;
end;
0
 

Author Comment

by:Raymond
ID: 9926852
Just copy the "Spin.pas" file to the project directory ?  Any other procedures?

Raymond
0
 

Author Comment

by:Raymond
ID: 9927023
After I reduce the height by 2:
FButton.SetBounds(Width - FButton.Width - 5, 0, FButton.Width, Height - 5 - 2)

Check the result:
http://home.i-cable.com/raymng/xp2.jpg

The look seems even worst... ;-(
Any idea ?

raymng
0
 
LVL 8

Expert Comment

by:Cesario
ID: 9927046
try to increase the hight
0
 

Author Comment

by:Raymond
ID: 9933757
Thanks Cesario.
It looks better after I increased the height by 1.

One last question:  Do I need to add the "Spin.pas" file to my project by selecting "Project" > "Add to Project" from the main menu ?   Just copy the file is ok ?

raymng
0
 

Accepted Solution

by:
chrml0606 earned 150 total points
ID: 9935155
Edit the name of the pas file, and include it under Uses. For example, if you rename the Spin.pas file to MySpin.pas, then you add MySpin under Uses in the unit you use the spinbar in. It's smart to rename it, so Delphi doesn't use the original, instead of yours in the project dir.
0
 

Author Comment

by:Raymond
ID: 9936839
chrml0606:

Actually Delphi uses my Spin.pas file even I didn't do the procedures you mentioned.
But I don't know that under what situation I need to do the "Project" > "Add to Project" ? and under what situation I need to add "Uses" in the unit ?

raymng
0
 

Author Comment

by:Raymond
ID: 9947441
Cesario and chrml0606:

Are you still here ?

raymng
0
 

Author Comment

by:Raymond
ID: 9972489
Cesario and chrml0606:

Hello, are you here ?

raymng
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…

809 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