Quote
Tidalwave News wrote:
> I have a few questions I've run into in developing my first Windows
> Application (Delphi 2.01):
> QUESTION ONE: CLIPBOARD - I have the clipboard working with my
> program.
> The mainmenu and popup menu works fine. The problem is with the Paste
> Button on the Toolbar. It works fine with events generated within the
> application, however, I do not know how to handle external clipboard
> events. For example if I have text on the clipboard (thus the paste
> button
> is enabled) and I go to the Clipboard Viewer in windows and delete the
> text. My Paste button does not disable, it is unaware of the change
> since
> it occured external to the program.
I don't think there's a message driven way of doing this. There is
a WM_DESTROYCLIPBOARD message, but it is only sent to the clipboard
owner, so you would only receive it when your own application modified
the clipboard. As a last result, you could create a timer to check
the clipboard periodically.
Quote
> QUESTION TWO: FONTS - I have the Font and Size Combo Boxes on my
> toolbar.
> I have seen documentation for the Font list using Screen.Fonts and
> Printer.Fonts. What I don't know is how to determine if the font is
> TrueType and put the appropriate Glyph beside it (Like in WordPad).
> Furthermore each font seems to have only certain valid size
> attributes. I
> don't know how to determine the valid sizes to generate the Size list.
I not sure if there is a Delphi function to do this, but you do this
using the EnumFontFamilies Win API call. Look it up in the online
help. Make sure to use the export directive with the callback function.
Quote
> QUESTION THREE: ICON - I have an icon associated with the application
> for
> use in Explorer etc. I would like, however, to change the icon
> depending
> on the type of file opened. This is apparently accomplished by
> assigning
> Application.Icon during Runtime. The problem is I don't know how to
> get
> the .ico files for the different associations to compile into the
> executable. The LoadFromFile method keeps it separate so requires the
> .ico
> files to be in the same directroy at runtime. I have tried the Image
> List
> component but I don't seem to be able to get it to display properly.
You could use the Image Editor that comes with Delphi to make a .RES
file containing the icons, giving them appropriate names within the
file, and then do something like this (using a Win API call)
Application.Icon.Handle := LoadIcon (HInstance, 'ICONNAME');
When done with the icon, call DestroyIcon (Application.Icon.Handle);
to free the memory it occupies. You probably want to immediately
load another icon, unless the application is closing.
Quote
> This is first and foremost a learning experience for me. Thus I am
> not
> interested in third party components unless they have free source code
> as I
> will not learn anything linking to pre-compiled code. Furthermore any
> pointers to other FREE Delphi References would be greatly appreciated.
> Thanks in advance for any help.
> NOTE: Please send a copy of any responses to nhan...@mail.vt.edu
If you have difficulties implementing any of this, feel free to e-mail
me for assistance.
Good Luck!
Jared Showalter
kens...@ix.netcom.com