|
From: Peter T. <pe...@us...> - 2003-08-23 23:20:33
|
Update of /cvsroot/jvcl/dev/JVCL3/examples/JvTipOfDay
In directory sc8-pr-cvs1:/tmp/cvs-serv5637/JVCL3/examples/JvTipOfDay
Added Files:
TipOfDayMainFormU.dfm TipOfDayMainFormU.pas TipsDemo.dof
TipsDemo.dpr TipsDemo.res loadme.txt
Log Message:
- Copied jvcl/devtools and jvcl/examples dev/JVCL3
- Copied JVCLConvert *.dat files to dev/JVCL3/converter
--- NEW FILE: TipOfDayMainFormU.dfm ---
object TipOfDayMainForm: TTipOfDayMainForm
Left = 320
Top = 278
BorderStyle = bsDialog
Caption = 'JVCL Tips Demo'
ClientHeight = 103
ClientWidth = 285
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 15
Top = 56
Width = 26
Height = 13
Caption = 'Style:'
end
object Button1: TButton
Left = 96
Top = 16
Width = 75
Height = 25
Caption = 'Load Tips'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 16
Top = 16
Width = 75
Height = 25
Caption = 'Show Tips'
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 176
Top = 16
Width = 75
Height = 25
Caption = 'Save Tips'
TabOrder = 2
OnClick = Button3Click
end
object cbStyle: TComboBox
Left = 16
Top = 72
Width = 257
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 3
Items.Strings = (
'Visual C'
'Standard')
end
object JvTip: TJvTipOfDay
ButtonNext.Caption = '&Next Tip'
ButtonNext.Flat = False
ButtonNext.HotTrack = False
ButtonNext.HotTrackFont.Charset = DEFAULT_CHARSET
ButtonNext.HotTrackFont.Color = clWindowText
ButtonNext.HotTrackFont.Height = -11
ButtonNext.HotTrackFont.Name = 'MS Sans Serif'
ButtonNext.HotTrackFont.Style = []
ButtonNext.ShowHint = False
ButtonClose.Caption = '&Close'
ButtonClose.Flat = False
ButtonClose.HotTrack = False
ButtonClose.HotTrackFont.Charset = DEFAULT_CHARSET
ButtonClose.HotTrackFont.Color = clWindowText
ButtonClose.HotTrackFont.Height = -11
ButtonClose.HotTrackFont.Name = 'MS Sans Serif'
ButtonClose.HotTrackFont.Style = []
ButtonClose.ShowHint = False
CheckBoxText = '&Show Tips on StartUp'
DefaultFonts = False
HeaderFont.Charset = DEFAULT_CHARSET
HeaderFont.Color = clWindowText
HeaderFont.Height = -20
HeaderFont.Name = 'Times New Roman'
HeaderFont.Style = [fsBold]
HeaderText = 'Did you know...'
Options = []
TipFont.Charset = DEFAULT_CHARSET
TipFont.Color = clWindowText
TipFont.Height = -11
TipFont.Name = 'Arial'
TipFont.Style = []
Tips.Strings = (
'The new merged tip component can display in two styles: Visual C' +
' and Standard.'
'You can save and load tips from files by using the methods LoadF' +
'romFile and SaveToFile.'
'You can control detailed aspects of the tip window, like the app' +
'erance of the buttons, the texts and all the different fonts use' +
'd in the dialog.'
'You can save and load tips from the registry by just setting a p' +
'roperty and the component will store the strings in a default lo' +
'cation for you (Software\JEDI-VCL\TipsStartup + your application' +
's name).'
'You can save and load tips from any location (f ex a database) b' +
'y assigning event handlers to the OnCanShow and OnAfterExecute e' +
'vents.'
'Each row (or line) of the TStrings property is loaded as a singl' +
'e tip in the window.'
'Since tips are displayed randomly, make sure your tips doesn'#39't a' +
'ssume the user has read one of the other tips: each tip should b' +
'e as self-contained as possible to not confuse the user.'
'To find out if the user wants to see tips the next time he runs ' +
'the program, check the toShowOnStartUp value in Options.')
Title = 'Tips and Tricks'
Left = 104
Top = 24
end
object OpenDialog1: TOpenDialog
DefaultExt = 'txt'
Filter = 'Tips (*.txt)|*.txt'
Left = 64
Top = 24
end
object SaveDialog1: TSaveDialog
DefaultExt = 'txt'
Filter = 'Tips (*.txt)|*.txt'
Left = 24
Top = 24
end
end
--- NEW FILE: TipOfDayMainFormU.pas ---
{$I JVCL.INC}
unit TipOfDayMainFormU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, JvComponent, JvBaseDlg, JvTipOfDay;
type
TTipOfDayMainForm = class(TForm)
JvTip: TJvTipOfDay;
Button1: TButton;
Button2: TButton;
Button3: TButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Label1: TLabel;
cbStyle: TComboBox;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FileDirectory: string;
end;
var
TipOfDayMainForm: TTipOfDayMainForm;
implementation
{$R *.dfm}
procedure TTipOfDayMainForm.Button2Click(Sender: TObject);
begin
JvTip.Style := TJvTipOfDayStyle(cbStyle.ItemIndex);
JvTip.Execute;
if toShowOnStartUp in JvTip.Options then
ShowMessage('You want to see tips the next time the application is started')
else
ShowMessage('You don''t want to see tips the next time the application is started')
end;
procedure TTipOfDayMainForm.Button1Click(Sender: TObject);
begin
OpenDialog1.InitialDir := FileDirectory;
if OpenDialog1.Execute then
JvTip.LoadFromFile(OpenDialog1.FileName);
end;
procedure TTipOfDayMainForm.Button3Click(Sender: TObject);
begin
SaveDialog1.InitialDir := FileDirectory;
if SaveDialog1.Execute then
JvTip.SaveToFile(SaveDialog1.FileName);
end;
procedure TTipOfDayMainForm.FormCreate(Sender: TObject);
begin
FileDirectory := ExtractFileDir(Application.ExeName);
cbStyle.ItemIndex := 0;
end;
end.
--- NEW FILE: TipsDemo.dof ---
[Directories]
OutputDir=..\..\Bin
UnitOutputDir=..\..\Dcu
SearchPath=..\..\Source;..\..\Common
--- NEW FILE: TipsDemo.dpr ---
program TipsDemo;
uses
Forms,
TipOfDayMainFormU in 'TipOfDayMainFormU.pas' {TipOfDayMainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TTipOfDayMainForm, TipOfDayMainForm);
Application.CreateForm(TTipOfDayMainForm, TipOfDayMainForm);
Application.Run;
end.
--- NEW FILE: TipsDemo.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: loadme.txt ---
...that this is a component that will make you jump with happiness ?
...that it took me 4 days to complete it ?
...that you can load and save tips to a textfile with the LoadFromFile and SaveToFile methods ?
...that you can set the font for the tips and the title ( the field above this text) ?
...that this unit is absolutely free for use by anyone ?
...that these stupid tips are here to demonstrate the fact that you can assign tips on the fly ?
...that when the modal box returns, it's return value is true if the user wants to see tips the next time they start the program ?
...that I can't find anything more to write ?
...that the first tip will come back when (and if) you click Next now ?
...that I just lied ? This is NOT the first tip!
...that the previous tip was the first tip that ended with an exclamation - all the others ends with a question mark (so do this one) ?
...that to create linebreaks inside the tip, you have to insert a lot of spaces. And it is very hard to determine where to start the next line...
|