Solved

Adding images to buttons created at run-time.

Posted on 1998-08-10
5
199 Views
Last Modified: 2010-04-04
This is sort of a follow-up question to one I asked earlier.

I am creating a bunch of buttons at run-time, and I want each button to have a bitmap image displayed on it.

NOTE:  I've noticed that you can dynamically create TButton...but for some reason TSpeedButton and TBitButton don't want to work.  Delphi keeps flaggin the declaration telling me that no corresponding component was found on the form itself.
0
Comment
Question by:Tom Knowlton
[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
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1361832
Try putting this,,,,,
  RunTimeCreatedBtn.Parent := Self; //try changing the parent and see what happens
..............

0
 
LVL 10

Accepted Solution

by:
viktornet earned 10 total points
ID: 1361833
Try this.....

uses buttons;

procedure TForm1.Button1Click(Sender: TObject);
var
  Btn : TSpeedButton;
begin
  Btn := TSpeedButton.Create(self);
  with Btn do
    begin
      Parent := Self;
      Top := 100;
      Left := 100;
      Width := 50;
      Height := 50;
      Glyph := NameOfBitmap;//This would be the image
      Visible := True;
    end;
end;
---------
Regards,
Viktor Ivanov
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1361834
Thanks Viktornet!
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1361835
Viktornet:

Check out the latest version of the Map Editor at:

www.enol.com/~knowlton

My newest change is there is now a floating Brush Palette from which you can select the Brush you want to paint with.  Pretty cool!
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1361836
Ok I will...Talk to you later...

Regards,
Viktor Ivanov
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

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 97
Correct Component for Shopping Cart. 2 136
How to load 2 images in same column in Delphi 2 81
Firemonkey BASS_Init into a thread 17 85
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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