Madboy
Jun 16th, 2004, 02:51 PM
Its in Delphi, the source was initially converted from VB6, but with modifications:
procedure TfrmTipOfTheDay.RandomizeTips;
var
sPossible: array[0..6] of string;
iTemp: integer;
begin
//Possible tips
sPossible[0]:= 'You can change the background colour of each individual document by selecting the Format, Background Colour menu.';
sPossible[1]:= 'You can quickly close all open documents by using the Window, Close All menu.';
sPossible[2]:= 'You can goto a certain line number by clicking Edit, Goto.' + #13#10 + #13#10 + 'You can then goto the beginning or end of the document as well as a sepcified line.';
sPossible[3]:= 'You can save time browsing through the menus for actions such as Cut, Copy, Paste etc when you can use the corresponding shortcut key.' + #13#10 + #13#10 + 'For example in the Edit menu Ctrl+V is shown next to Paste, so if you click Ctrl+V it will paste text from the clipboard into your document.';
sPossible[4]:= 'You can hide Super Editor in the system tray and use it when you need to.' + #13#10 + #13#10 + 'Simply right click the Super Editor icon from the system tray to show a menu of options.' + #13#10 + #13#10 + 'You can disable the Super Editor icon from showing in the system tray by unselecting it from the Options window.';
sPossible[5]:= 'When saving your document the document colour is not saved with the file.' + #13#10 + #13#10 + 'Super Editor does however store text formatting such as colour, bold, alginment etc depending on the saved format.' + #13#10 + #13#10 + 'For help on saving your documents in different file types please see the Help file.';
sPossible[6]:= 'You can stop the Tip of the day from showing when Super Editor loads.' + #13#10 + #13#10 + 'To do this goto View, Options and unselect the Show tip of the day at startup checkbox.' + #13#10 + #13#10 + 'When Tip of the day is turned off you can still view it by clicking Help, Tip of the day.';
//Randomize tips
Randomize;
repeat
iTemp:= Random(7);
Until iLast <> iTemp;
iLast:= iTemp;
lblMain.Caption:= sPossible[iTemp];
//Show tip number
if lblMain.Caption = 'You can change the background colour of each individual document by selecting the Format, Background Colour menu.' then
lblTipNumber.Caption:= 'Tip 1 of 8'
else if lblMain.Caption = 'You can quickly close all open documents by using the Window, Close All menu.' then
lblTipNumber.Caption:= 'Tip 2 of 8'
else if lblMain.Caption = 'You can quickly close all open documents by using the Window, Close All menu.' then
lblTipNumber.Caption:= 'Tip 3 of 8'
else if lblMain.Caption = 'You can goto a certain line number by clicking Edit, Goto.' + #13#10 + #13#10 + 'You can then goto the beginning or end of the document as well as a sepcified line.' then
lblTipNumber.Caption:= 'Tip 4 of 8'
else if lblMain.Caption = 'You can save time browsing through the menus for actions such as Cut, Copy, Paste etc when you can use the corresponding shortcut key.' + #13#10 + #13#10 + 'For example in the Edit menu Ctrl+V is shown next to Paste, so if you click Ctrl+V it will paste text from the clipboard into your document.' then
lblTipNumber.Caption:= 'Tip 5 of 8'
else if lblMain.Caption = 'You can hide Super Editor in the system tray and use it when you need to.' + #13#10 + #13#10 + 'Simply right click the Super Editor icon from the system tray to show a menu of options.' + #13#10 + #13#10 + 'You can disable the Super Editor icon from showing in the system tray by unselecting it from the Options window.' then
lblTipNumber.Caption:= 'Tip 6 of 8'
else if lblMain.Caption = 'When saving your document the document colour is not saved with the file.' + #13#10 + #13#10 + 'Super Editor does however store text formatting such as colour, bold, alginment etc depending on the saved format.' + #13#10 + #13#10 + 'For help on saving your documents in different file types please see the Help file.' then
lblTipNumber.Caption:= 'Tip 7 of 8'
else if lblMain.Caption = 'You can stop the Tip of the day from showing when Super Editor loads.' + #13#10 + #13#10 + 'To do this goto View, Options and unselect the Show tip of the day at startup checkbox.' + #13#10 + #13#10 + 'When Tip of the day is turned off you can still view it by clicking Help, Tip of the day.' then
lblTipNumber.Caption:= 'Tip 8 of 8'
end;
Instead of me comparing the current caption to displaying the current Tip number, im sure there is a way to check by the tip value. For example, what i had in mind was:
If sPossible = [0] Then
lblTipNumber.Caption:= 'Tip 1 of 8'
But i run into problems, appreciate if anyone can give maybe not code, but advice on what to do?
Cheers
procedure TfrmTipOfTheDay.RandomizeTips;
var
sPossible: array[0..6] of string;
iTemp: integer;
begin
//Possible tips
sPossible[0]:= 'You can change the background colour of each individual document by selecting the Format, Background Colour menu.';
sPossible[1]:= 'You can quickly close all open documents by using the Window, Close All menu.';
sPossible[2]:= 'You can goto a certain line number by clicking Edit, Goto.' + #13#10 + #13#10 + 'You can then goto the beginning or end of the document as well as a sepcified line.';
sPossible[3]:= 'You can save time browsing through the menus for actions such as Cut, Copy, Paste etc when you can use the corresponding shortcut key.' + #13#10 + #13#10 + 'For example in the Edit menu Ctrl+V is shown next to Paste, so if you click Ctrl+V it will paste text from the clipboard into your document.';
sPossible[4]:= 'You can hide Super Editor in the system tray and use it when you need to.' + #13#10 + #13#10 + 'Simply right click the Super Editor icon from the system tray to show a menu of options.' + #13#10 + #13#10 + 'You can disable the Super Editor icon from showing in the system tray by unselecting it from the Options window.';
sPossible[5]:= 'When saving your document the document colour is not saved with the file.' + #13#10 + #13#10 + 'Super Editor does however store text formatting such as colour, bold, alginment etc depending on the saved format.' + #13#10 + #13#10 + 'For help on saving your documents in different file types please see the Help file.';
sPossible[6]:= 'You can stop the Tip of the day from showing when Super Editor loads.' + #13#10 + #13#10 + 'To do this goto View, Options and unselect the Show tip of the day at startup checkbox.' + #13#10 + #13#10 + 'When Tip of the day is turned off you can still view it by clicking Help, Tip of the day.';
//Randomize tips
Randomize;
repeat
iTemp:= Random(7);
Until iLast <> iTemp;
iLast:= iTemp;
lblMain.Caption:= sPossible[iTemp];
//Show tip number
if lblMain.Caption = 'You can change the background colour of each individual document by selecting the Format, Background Colour menu.' then
lblTipNumber.Caption:= 'Tip 1 of 8'
else if lblMain.Caption = 'You can quickly close all open documents by using the Window, Close All menu.' then
lblTipNumber.Caption:= 'Tip 2 of 8'
else if lblMain.Caption = 'You can quickly close all open documents by using the Window, Close All menu.' then
lblTipNumber.Caption:= 'Tip 3 of 8'
else if lblMain.Caption = 'You can goto a certain line number by clicking Edit, Goto.' + #13#10 + #13#10 + 'You can then goto the beginning or end of the document as well as a sepcified line.' then
lblTipNumber.Caption:= 'Tip 4 of 8'
else if lblMain.Caption = 'You can save time browsing through the menus for actions such as Cut, Copy, Paste etc when you can use the corresponding shortcut key.' + #13#10 + #13#10 + 'For example in the Edit menu Ctrl+V is shown next to Paste, so if you click Ctrl+V it will paste text from the clipboard into your document.' then
lblTipNumber.Caption:= 'Tip 5 of 8'
else if lblMain.Caption = 'You can hide Super Editor in the system tray and use it when you need to.' + #13#10 + #13#10 + 'Simply right click the Super Editor icon from the system tray to show a menu of options.' + #13#10 + #13#10 + 'You can disable the Super Editor icon from showing in the system tray by unselecting it from the Options window.' then
lblTipNumber.Caption:= 'Tip 6 of 8'
else if lblMain.Caption = 'When saving your document the document colour is not saved with the file.' + #13#10 + #13#10 + 'Super Editor does however store text formatting such as colour, bold, alginment etc depending on the saved format.' + #13#10 + #13#10 + 'For help on saving your documents in different file types please see the Help file.' then
lblTipNumber.Caption:= 'Tip 7 of 8'
else if lblMain.Caption = 'You can stop the Tip of the day from showing when Super Editor loads.' + #13#10 + #13#10 + 'To do this goto View, Options and unselect the Show tip of the day at startup checkbox.' + #13#10 + #13#10 + 'When Tip of the day is turned off you can still view it by clicking Help, Tip of the day.' then
lblTipNumber.Caption:= 'Tip 8 of 8'
end;
Instead of me comparing the current caption to displaying the current Tip number, im sure there is a way to check by the tip value. For example, what i had in mind was:
If sPossible = [0] Then
lblTipNumber.Caption:= 'Tip 1 of 8'
But i run into problems, appreciate if anyone can give maybe not code, but advice on what to do?
Cheers