Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delphi ToolBar Problem

Posted on 2008-10-27
2
Medium Priority
?
1,775 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 1500 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: 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

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 perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

719 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