TIP: Click on subject to list as thread! ANSI
echo: delphi
to: JOAQUIM HOMRIGHAUSEN
from: MARTIN MAAT
date: 1997-10-29 10:13:00
subject: Icons (Delphi 1.x)

Hallo Joaquim
 RW> With the form as the active component, in the Object Inspector
 RW> click on the "Picture".  That will bring up the Icon selector
 RW> window.
 JH> Thanks - but I want to do it at run-time.
It looks like you intend to create an MDI application holding different types 
of child windows.  Been there, done that. shouldn't have. If the childs 
aren't the same objects, you should make it an SDI application or use (modal) 
dialogs for the parts that are different.
In case you'd want to create your own version of Windows, this is the way. 
Put a collection of image controls on your form containing the desired 
pictures, then in the CreateForm event put:
case FormType of  { FormType is an enumerated type you defined }
  ft1: Icon := img1.Picture.Icon;
  ft2: Icon := img2.Picture.Icon;
  ft3: Icon := img3.Picture.Icon;
end;
Note you're sort of orphaning the original icon here but it won't do any harm 
since it still has an owner and will be properly freed at sometime by that 
owner. Instead you could use the assign method. But then again, you should 
_not_ do this anyway.
Groeten, Martin.
--- FMail/Win32 1.22
---------------
* Origin: -=[ E-mail: m_maat@knoware.nl .......... ]=- (2:286/420.1)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.