Solved

Delphi ToolBar Problem

Posted on 2008-10-27
2
1,709 Views
Last Modified: 2013-11-23
I am making my application as resolution indepandant but toolbuttons are not calculated depends on my formula for resolution which is applying for other components

Below is mycode

for idx := 0 to -1 + self.ComponentCount do
  begin
    if Components[idx] is TControl then
    begin
      ctrl := TControl(Components[idx]) ;
      if (ctrl.Name = 'LEADImage1') or (ctrl.Name = 'OutputImage') then  continue;
      ctrl.Top := ctrl.Top * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Height := ctrl.Height  * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Left := ctrl.Left  * longint(screen.Width) div
                  ScreenWidth;
      ctrl.Width := ctrl.Width * longint(screen.Width) div
                  ScreenWidth;
      if GetPropInfo(ClassInfo, 'font')<>nil then
               Font.Size := (GetSystemMetrics(0)  div ScreenWidth)
                           *font.Size;
    end;
  end;
0
Comment
Question by:inampudi1
[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 4

Accepted Solution

by:
dprochownik earned 500 total points
ID: 22810913
Toolbar button are specific component which don't decide about their size. You have to change button size for TToolBar component, which contains Toolbuttons

You can simply change yours procedure like this:


for idx := 0 to -1 + self.ComponentCount do
  begin
    if Components[idx] is TToolBar then
    begin
      TToolBar(Components[idx]).ButtonHeight := TToolBar(Components[idx]).ButtonHeight  * longint(screen.Height) div
                  ScreenHeight;
      TToolBar(Components[idx]).ButtonWidth := TToolBar(Components[idx]).ButtonWidth * longint(screen.Width) div
                  ScreenWidth;
    end
    else if Components[idx] is TControl then
    begin
      ctrl := TControl(Components[idx]) ;
      if (ctrl.Name = 'LEADImage1') or (ctrl.Name = 'OutputImage') then  continue;
      ctrl.Top := ctrl.Top * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Height := ctrl.Height  * longint(screen.Height) div
                  ScreenHeight;
      ctrl.Left := ctrl.Left  * longint(screen.Width) div
                  ScreenWidth;
      ctrl.Width := ctrl.Width * longint(screen.Width) div
                  ScreenWidth;
      if GetPropInfo(ClassInfo, 'font')<>nil then
               Font.Size := (GetSystemMetrics(0)  div ScreenWidth)
                           *font.Size;
    end;
  end;

Open in new window

0
 

Author Closing Comment

by:inampudi1
ID: 31510222
thanks a lot for your assistance in solving my problem
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
eclipse ide not starting 16 88
Reference external folders in Visual Studio 4 91
CKEditor - will not function 7 81
what is the best Integrated development environment 2 65
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

732 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