Solved

Delphi ToolBar Problem

Posted on 2008-10-27
2
1,632 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
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now