############################ # HintBox # ############################ (Please turn on WordWrap) {German Version at the bottom!} HintBox is a Form to show Informations to the user. The HintBox has a Checkbox. If the user checks it, the Window will not be displayed even if the program calls the Routine to show it. HintBox uses the Registry to save the informations. Because the unit is very small, it is not programmed using the OOP Features of Delphi. In the whole unit are only two procedures: The one to create the window and show it and one to save the state of the checkbox to the registry. Here ist the description of the procedure which displays the window: procedure ShowHintW(key, header, text, checktext, title:String; ico:TIcon); The Parameters: Name Use ---- ---- key Save the Infos under HKEY_CURRENT_USER (with a \ at the end!) Example: if key is "\Software\PH-Arts\HintBox", the unit will save the state of the checkbox under HKEY_CURRENT_USER\Software\PH-Arts\HintBox header This is shown at the top of the Memo-Box. (In the GIF-File: The Phrase "Did you know") text This ist the text to be displayed. checktext The text of the checkbox (Look at the Picture!) title The Title of the Window ico The icon to display in the window. If the parameter is set to nil, the icon of the Application will be displayed (Application.Icon); IMPORTANT: The Routine creates the Form dynamically: You will not need to include the Unit to your project. This will need much to many memory. You can call the procedure without creating the form. If you include the unit in your project you have to prevent the form from beeing created automatically. The rest wil go automatically. If you wish to display all the messages again, you will have to delete the key you defined in the procedure. All parameters have a cool feature: If you give a number in the string (e.g '34'), ShowHintW will convert it to an intger and will read the String of this number from the Stringtable of a .RES-File included with {$R whatever.res} If you wish to have a cool sample, please have a look at my program RasInTask (http://www.mittelschule.ch/pilif), for which I designed the HintBox. In the Unit Optionen.pas you will find the solution how to redisplay all the messages if my sentence above was not easy to understand... History 1.0 First Release. Prograsmmed for my program RasInTask with many limitations: The features I didn't need were not implemented. 1.01 This release. The Bug with the \n from ResStrings which weren't displayed is fixed. You can now change the icon. Can now get ALL texts from .RES-File. In version 1.0 this was only possible with the parameter "text". -------------------------------------------------------- HintBox ist ein Formular, das dazu benutzt werden sollte, dem Benutzer Hinwiese zur Bedienung des Programmes anzuzeigen. Wie auf dem Bild (HintBox.gif) zu sehen, gibt das Fenster dem Benutzer die Möglichkeit, die Meldung nicht mehr anzuzeigen. Das Alles läuft vollautomatisch ab. Wenn Du die Startroutine aufrufst, erkennt die unit selbstständig, ob sie das Fenster nun anzeiogen soll, oder nicht. Weil das Programm so schön klein ist und es das auch bleiben sollte, habe ich auf allen Objektorientierten Anhang verzeichtet und das ganze über eine einzelne Routine gesteuert. Die Unit enthält nur noch eine Ereignisprozedure, die dafür sorgt, dass der Zustand der Checkbox auch gespeichert wird. Hier eine Beschreibung der Routine, die das Formaular erzeugt, die Registry liest und das Formaular bei Bedarf anzeigt: procedure ShowHintW(key, header, text, checktext, title:String; ico:TIcon); Name Zweck ---- ---- key Spichert den Zustand der Checkbox unter HKEY_CURRENT_USER (mit einem \ am Ende!). Beispiel: Angenommen key sei "\Software\PH-Arts\HintBox", wird die Prozedur den Zustand der Checkbox unter HKEY_CURRENT_USER\Software\PH-Arts\HintBox speichern header Dies ist der Text über dem Memo-Feld. (In der Grafik: "Wussten Sie schon") text Der anzuzeigende Text. checktext Bechreibung der Checkbox (Look at the Picture!) title Fenstertitel ico Das anzuzeigende Icon. Wenn ico auf 'nil' gesetzt ist, wird das Icon der Anwendung verwendet (Application.Icon). WICHTIG: Die Prozedur erzeigt das Formular automatisch. Die Unit muss nicht in das Projekt aufgenommen werden, anderenfalls wird Speicher des Systemes verbraucht. Wenn die Unit dennoch in das Projekt aufgenommen werden soll, muss das Formular aus der autom. Formualrdarstellung ausgeschlossen werden. Die Prozedur kann ohne Instanzierung des Formulares aufgerufen werden! Der ganze Rest läuft automatisch ab. Wenn Du aber dafür sorgen willst, dass alle Meldungen wieder angezeigt werden, musst Du einfach den im Parameter 'key' definierten Schlüssel komplett löschen. Die Parameter der Prozedur haben ein cooles Feature eingebaut: Wenn ein eine Zahl als String übergeben wird ('34'), wird diese in einen Integer konvertiert und der zugehörige String aus einer Stringtable einer .RES-Datei geladen, die mit {$R whatever.res} zum Projekt hinzugefügt worden ist. Ein gutes Beispiel findest Du in meinem Programm RasInTask (http://www.mittelschule.ch/pilif), für das ich übrigens diese Unit überhaupt geschriben habe. History 1.0 Erstes Release. Weil ich die Routine ursprünglich für mein Programm RasInTask geshrieben habe, waren häufig nur Features eingebaut, die ICH gebraucht habe. Ausserdem war das Icon fest vorbestimmt. 1.01 Dieses Release. Zeilenumbrüche werden im Memofeld nun korrekt dargestellt. Ausserdem kann das Icon geändert werden und alle Parameter unterstützen das 'ZahlImString'-Feature. In 1.0 war das nur mit dem Parameter 'text' möglich. -------------------------------------------------------- © 1998 by Pilif (pilit@dataway.ch) for this ReadmeFile, the unit HintBox.Pas, and the Form HintBox.dfm. All my programs are Freeware with full source, so you can do with HintBox what you would like to do with it!