Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Greetings form - a foxy way to send your greetings. 1

Status
Not open for further replies.

ramani

Programmer
Mar 15, 2001
4,336
AE
Greetings form - a foxy way to send your greetings. My seasons greetings to all the readers and a happy healthy prosperous new year ahead.

The following vfp code can be used as a greetings form. You can call this as a function with your custom greetings words to suit the occassion and add your personal name as signature besides using your own bmp or gif or jpg to show picture. When run, the form will have flashing greetings words and a snowing effect, if the gif is added. WIthout the gif, a blue background and snow or big size flowers falling from above. Have fun !

The following is available in my site also..

The code is provided below..
**********************************************************
** Author : Ramani (Subramanian.G)
** FoxAcc Software / Winners Software
** Type : Freeware with reservation to Copyrights
** Warranty : Nothing implied or explicit
**********************************************************
tCaption1 = "Seasons Greetings .. "
tCaption2 = ".. & Happy New Year - Ramani"
tImage = "xmas.gif"
=gsGreet(tCaption1,tCaption2,tImage)
**********************************************
xmas.gif

**********************************************
** gsGreet.PRG
** How to run ..
** =gsGreet(tCaption1,tCaption2,tImage)
** You can use your own Bmp or Gif file
** You can also save the picture above as xmas.jpg
** by right click mouse over it and save that
** in the same place as you save this prg.
**********************************************
* Greetings Card form
PROCEDURE gsGreet
PARAMETERS tCaption1, tCaption2, tImage

PUBLIC oform1
oform1=NEWOBJECT("gForm",'','',tCaption1,tCaption2, tImage)
oForm1.TitleBar = 0 && if you wish to have no titlebar
oform1.Show
RETURN
**********************************************
**********************************************
DEFINE CLASS gForm AS form

Height = 454
Width = 633
DoCreate = .T.
BackColor = RGB(0,0,128)
Name = "Greetings"
cSnow = "'"
nSnow = 0
nSnowFont = 20

Add object Text1 as label with ;
AutoSize = .T., ;
BackStyle = 0, ;
FontBold = .T., ;
FontItalic = .T., ;
FontSize = 24, ;
Left = 24, ;
Name = "Text1"

Add object Text2 as label with ;
AutoSize = .T., ;
BackStyle = 0, ;
FontBold = .T., ;
FontItalic = .T., ;
FontSize = 24, ;
Left = 96, ;
Name = "Text2"

PROCEDURE init
LPARAMETERS tCaption1, tCaption2, tGif

IF EMPTY(tCaption2)
tCaption2 = "from Ramani (Subramanian.G)"
ENDIF
IF EMPTY(tCaption1)
tCaption1 = "Greetings !!!"
ENDIF
WITH ThisForm
.Text1.Caption = tCaption1
.Text2.Caption = tCaption2
.Text1.Top = .Height - 72
.Text2.Top = .Height -36
IF !FILE(tGif)
.cSnow = "*"
.nSnowFont = 36
ELSE
.BackColor = RGB(253,254,249)
.ADDOBJECT("Image1","Image")
WITH .Image1
.Picture = tGif
.Stretch = 2
.Width = ThisForm.Width
.Height = ThisForm.Height - 72
.Top = 0
.Left = 0
.Zorder(1)
.Visible = .t.
ENDWITH
ENDIF
**
.nSNow = 50 && Max of t*i
x = 1
FOR t=0 TO 5
FOR I=1 TO 10
cI = ALLTRIM(STR((t*10)+I))
.ADDOBJECT("greet&cI","LABEL")
.greet&cI..AutoSize = .T.
.greet&cI..BackStyle = 0
.greet&cI..FontSize = ThisForm.nSnowFont
.greet&cI..Caption = ThisForm.cSnow
.greet&cI..Left = (i*50) + (10*rand())
.greet&cI..Top = (t*90) + (10*rand())
.greet&cI..Name = "greet&cI"
.greet&cI..ForeColor = RGB(255,255,255)
.greet&cI..Visible = .t.
ENDFOR
ENDFOR
.ADDOBJECT("Timer1","Timer1")
ENDWITH
ENDPROC

PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 27
ThisForm.Release()
ENDIF
ENDPROC

ENDDEFINE
**********************************************
DEFINE CLASS timer1 AS Timer
Interval = 100
Name = "Timer1"

PROCEDURE Timer
WITH ThisForm
.Text2.forecolor = .Text1.ForeColor
DO CASE
CASE .Text1.forecolor=16711680
.Text1.forecolor=255
CASE .Text1.forecolor=255
.Text1.forecolor=8421376
CASE .Text1.forecolor=8421376
.Text1.forecolor=8388863
OTHERWISE
.Text1.forecolor=16711680
ENDCASE
ENDWITH
**
FOR i= 1 TO ThisForm.nSnow
zm_g='thisform.greet'+alltrim(str(i))
zm_gl=zm_g+'.left'
IF &zm_gl<572
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
zm_gl=zm_g+'.top'
IF &zm_gl<392
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
ENDFOR
ENDPROC
ENDDEFINE
**********************************************
** EOF
**********************************************




____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 


Nice form, but I noticed some code in there that look familiar...Monikai perhaps?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi

Mike. Merry christmas to you.

And you are right, the idea was originaly started by Monikai and I did the code for some snow effects and gifs etc.. I was searching for the thread and my keyword used did not bring that out. Now I got it by putting the keyword Christmas.

My Christmas Form
thread184-434958

Merry Christmas to Monikai and credits to her to make me dvelop this form to this level. Over the years, it has taken many shapes with different festivals for me. I was not knowing to put up a jpg in this site earlier, though Monikai got that by email from me at that time. Now that I know how to, I posted it here as well.

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Hi,
How can we make its exe file. When I do so....and run it...it shows me a blink of that form. i.e. it opens and close in 1 sec.
To resove this I use read events in the above prg, but it shows an error. Again, I made another main.prg where I wrote these codes

on escape quit
do christmas.prg
read events

and then make its exe....but then also its not working.

I want it to send to my some friends who are not having vfp installed in their computer.

How can I do so?

Merry Christmas to everybody

Thanks and Regards
 
1. Add your xmas.gif in your project
2. If you are adding xmas.bmp, suitably change in appropriate one line
3. Add the follwoing in your project as a PRG and set that as the main. Compile it into an execute.
**************************************************
** Author : Ramani (Subramanian.G)
** FoxAcc Software / Winners Software
** Type : Freeware with reservation to Copyrights
** Warranty : Nothing implied or explicit
**************************************************
ON ERROR DO errhand WITH ;
ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO(1)
ON SHUTDOWN DO myShutDown
**************************************************
_screen.Visible = .f.

PUBLIC gcHomeDirectory, gcAppPath
gcHomeDirectory = JUSTPATH(SYS(16,0))
SET DEFAULT TO (gcHomeDirectory)
gcAppPath = ADDBS(gcHomeDirectory)

tCaption1 = &quot;Seasons Greetings .. &quot;
tCaption2 = &quot;.. & Happy New Year - Ramani&quot;
tImage = &quot;xmas.gif&quot;
=gsGreet(tCaption1,tCaption2,tImage)
READ EVENTS
CLEAR EVENTS
ON ShutDown
RETURN
**************************************************
** My error handler
PROCEDURE errhand
PARAMETER merror, mess, mess1, mprog, mlineno
LOCAL myMessage
myMessage='Error number: ' + LTRIM(STR(merror))+ CHR(13) ;
+ 'Error message: ' + mess + CHR(13) ;
+ 'Line of code with error: ' + mess1 + CHR(13);
+ 'Line number of error: ' + LTRIM(STR(mlineno)) + CHR(13) ;
+ 'Program with error: ' + mprog
=MESSAGEBOX(myMessage,&quot;ERROR !!!&quot;,16)
RETURN
**************************************************
PROCEDURE myShutDown
CLEAR EVENTS
QUIT
ENDPROC
**************************************************
** EOF
**************************************************
** gsGreet.PRG
** How to run ..
** =gsGreet(tCaption1,tCaption2,tImage)
** You can use your own Bmp or Gif file
** You can also save the picture above as xmas.jpg
** by right click mouse over it and save that
** in the same place as you save this prg.
**********************************************
* Greetings Card form
PROCEDURE gsGreet
PARAMETERS tCaption1, tCaption2, tImage

PUBLIC oform1
oform1=NEWOBJECT(&quot;gForm&quot;,'','',tCaption1,tCaption2, tImage)
oForm1.TitleBar = 0 && if you wish to have no titlebar
oform1.Show
RETURN
**********************************************
**********************************************
DEFINE CLASS gForm AS form

Height = 454
Width = 633
AutoCenter = .t.
DoCreate = .T.
BackColor = RGB(0,0,128)
Name = &quot;Greetings&quot;
ShowWindow = 2
cSnow = &quot;'&quot;
nSnow = 0
nSnowFont = 20

Add object Text1 as label with ;
AutoSize = .T., ;
BackStyle = 0, ;
FontBold = .T., ;
FontItalic = .T., ;
FontSize = 24, ;
Left = 24, ;
Name = &quot;Text1&quot;

Add object Text2 as label with ;
AutoSize = .T., ;
BackStyle = 0, ;
FontBold = .T., ;
FontItalic = .T., ;
FontSize = 24, ;
Left = 96, ;
Name = &quot;Text2&quot;

PROCEDURE init
LPARAMETERS tCaption1, tCaption2, tGif

IF EMPTY(tCaption2)
tCaption2 = &quot;from Ramani (Subramanian.G)&quot;
ENDIF
IF EMPTY(tCaption1)
tCaption1 = &quot;Greetings !!!&quot;
ENDIF
WITH ThisForm
.Text1.Caption = tCaption1
.Text2.Caption = tCaption2
.Text1.Top = .Height - 72
.Text2.Top = .Height -36
IF !FILE(tGif)
.cSnow = &quot;*&quot;
.nSnowFont = 36
ELSE
.BackColor = RGB(253,254,249)
.ADDOBJECT(&quot;Image1&quot;,&quot;Image&quot;)
WITH .Image1
.Picture = tGif
.Stretch = 2
.Width = ThisForm.Width
.Height = ThisForm.Height - 72
.Top = 0
.Left = 0
.Zorder(1)
.Visible = .t.
ENDWITH
ENDIF
**
.nSNow = 50 && Max of t*i
x = 1
FOR t=0 TO 5
FOR I=1 TO 10
cI = ALLTRIM(STR((t*10)+I))
.ADDOBJECT(&quot;greet&cI&quot;,&quot;LABEL&quot;)
.greet&cI..AutoSize = .T.
.greet&cI..BackStyle = 0
.greet&cI..FontSize = ThisForm.nSnowFont
.greet&cI..Caption = ThisForm.cSnow
.greet&cI..Left = (i*50) + (10*rand())
.greet&cI..Top = (t*90) + (10*rand())
.greet&cI..Name = &quot;greet&cI&quot;
.greet&cI..ForeColor = RGB(255,255,255)
.greet&cI..Visible = .t.
ENDFOR
ENDFOR
.ADDOBJECT(&quot;Timer1&quot;,&quot;Timer1&quot;)
ENDWITH
ENDPROC

PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 27
DO myShutDown
ENDIF
ENDPROC

ENDDEFINE
**********************************************
DEFINE CLASS timer1 AS Timer
Interval = 100
Name = &quot;Timer1&quot;

PROCEDURE Timer
WITH ThisForm
.Text2.forecolor = .Text1.ForeColor
DO CASE
CASE .Text1.forecolor=16711680
.Text1.forecolor=255
CASE .Text1.forecolor=255
.Text1.forecolor=8421376
CASE .Text1.forecolor=8421376
.Text1.forecolor=8388863
OTHERWISE
.Text1.forecolor=16711680
ENDCASE
ENDWITH
**
FOR i= 1 TO ThisForm.nSnow
zm_g='thisform.greet'+alltrim(str(i))
zm_gl=zm_g+'.left'
IF &zm_gl<572
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
zm_gl=zm_g+'.top'
IF &zm_gl<392
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
ENDFOR
ENDPROC
ENDDEFINE
**********************************************
** EOF
**********************************************


____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
Merry Christmas & Happy New Year
 
Hi,
I'm very happy that you (Mike, Ramani) remember about me. Now i look at TT only sometimes (TIME !!!).
;-)

Regards from Monika (Warszawa - Poland)
(monikai@yahoo.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top