Solved

Adding images to buttons created at run-time.

Posted on 1998-08-10
5
200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

628 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