Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding images to buttons created at run-time.

Posted on 1998-08-10
5
Medium Priority
?
201 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 40 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

721 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