Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Koen Piller
  Where is Koen Piller?
 Santpoort-Zuid
 Netherlands
 Koen Piller
 To: Rakesh Kumar
  Where is Rakesh Kumar?
 Sunam
 India
 Rakesh Kumar
 Tags
Subject: RE: Form with Prg file
Thread ID: 373833 Message ID: 373836 # Views: 90 # Ratings: 1
Version: Visual FoxPro 9 Category: Forms
Date: Wednesday, March 27, 2013 6:13:19 PM         
   


> Dear Experts
> i define form with prg file and i want to run another form with prg file, but i'm failed, so, please help me for this coding a under :
> thanks advance
> *-------------------------------------------------
> * this is first Main file :
> _SCREEN.HEIGHT=SYSMETRIC(2)
> _SCREEN.WIDTH=SYSMETRIC(1)
> _screen.Visible = .f.
>
> Lform = Newobject("LForm")
> Lform.show
> read events
> return
> DEFINE CLASS Lform AS Form
> ShowWindow = 0
> name = "rna"
> width=1020
> height=710
> movable = .f.
> desktop = .t.
> themes = .t.
> windowstate = 0
> showwindow = 2
> closable = .t.
> minbutton = .t.
> maxbutton =.t.
> enable = .t.
> borderstyle = 0
> visible = .f.
> procedure init
> CLOSE TABLES
> CLOSE ALL
> CLOSE DATABASES
> CLOSE TABLES
> ENDPROC
> *--------------------------------------------------------------------------
> procedure destroy
> clea events
> endproc
> ADD OBJECT command1 AS commandbutton WITH ;
> Top = 50, ;
> Left = 25, ;
> Height = 200, ;
> Width = 200, ;
> wordwrap = .t.,;
> pictureposition = 12,;
> fontsize = 12,;
> themes = .t.,;
> caption = 'Menu2',;
> Name = "Command1"
>
> ADD OBJECT command2 AS commandbutton WITH ;
> Top = 150, ;
> Left = 225, ;
> Height = 200, ;
> Width = 200, ;
> Caption = "Menu3", ;
> pictureposition = 12,;
> fontsize = 12,;
> themes = .t.,;
> wordwrap = .t.,;
> Name = "Command2"
>
> ADD OBJECT command3 AS commandbutton WITH ;
> Top = 225, ;
> Left = 425, ;
> Height = 200, ;
> Width = 200, ;
> wordwrap = .t.,;
> pictureposition = 12,;
> fontsize = 12,;
> Caption = "Menu4", ;
> Name = "Command3"
>
> ADD OBJECT command4 AS commandbutton WITH ;
> Top = 300, ;
> Left = 625, ;
> Height = 200, ;
> Width = 200, ;
> wordwrap = .t.,;
> fontsize = 12,;
> Caption = "Exit", ;
> Name = "Command4"
>
> procedure init
> this.dock(0)
> this.setall("mousepointer",15,"commandbutton")
>
> PROCEDURE command1.Click
> DO master\prgs\menu2
> ENDPROC
>
> PROCEDURE command2.Click
> DO master\prgs\menu3
> ENDPROC
>
> PROCEDURE command3.Click
> DO master\prgs\menu4
> ENDPROC
>
> PROCEDURE command4.Click
> quit
> clear event
> close databases
> ENDPROC
> ENDDEFINE
>
> *--------------------------------------------------
> * this is 'Master\prgs\menu2.prg file
> CLOSE DATABASES
> SET SAFE OFF
> SET TALK OFF
> SET CENT ON
> SET DATE TO BRIT
> SET CONF ON
> SET EXACT ON
>
> _SCREEN.HEIGHT=SYSMETRIC(2)
> _SCREEN.WIDTH=SYSMETRIC(1)
> _screen.Visible = .f.
>
> Ioform = Newobject("IoForm")
> Ioform.show
>
> ytoolbar = Newobject("asup")
> ytoolbar.Show()
> read events
> return
> DEFINE CLASS Ioform AS Form
> ShowWindow = 0
> name = "form1"
> width=1020
> height=710
> movable = .f.
> desktop = .t.
> themes = .t.
> windowstate = 0
> showwindow = 2
> closable = .f.
> minbutton = .f.
> maxbutton =.f.
> enable = .t.
> borderstyle = 0
> visible = .f.
> procedure init
> CLOSE TABLES
> CLOSE ALL
> CLOSE DATABASES
> CLOSE TABLES
> thisform.ymenu(thisform,.t.)
> ENDPROC
>
> procedure ymenu
> LPARAMETERS oFormRef, getMenuName, lUniquePopups, parm4, parm5, parm6, parm7, parm8, parm9
> LOCAL cMenuName, nTotPops, cTypeParm2, cSaveFormName
> IF TYPE("m.oFormRef") # "O" OR ;
> LOWER(m.oFormRef.BaseClass) # 'form' OR ;
> m.oFormRef.ShowWindow # 2
> MESSAGEBOX([This menu can only be called from a Top-Level form. Ensure that your form's ShowWindow property is set to 2. Read the header section of the menu's MPR file for more details.])
> RETURN
> ENDIF
> m.cTypeParm2 = TYPE("m.getMenuName")
> m.cMenuName = SYS(2015)
> m.cSaveFormName = m.oFormRef.Name
> IF m.cTypeParm2 = "C" OR (m.cTypeParm2 = "L" AND m.getMenuName)
> m.oFormRef.Name = m.cMenuName
> ENDIF
> IF m.cTypeParm2 = "C" AND !EMPTY(m.getMenuName)
> m.cMenuName = m.getMenuName
> ENDIF
> * *********************************************************
> * * Menu Definition
> * *********************************************************
> DEFINE MENU (m.cMenuName) IN (m.oFormRef.Name) BAR
>
> DEFINE PAD Mast OF (m.cMenuName) PROMPT '\<Master' ;
> KEY ALT+M,"ALT+M" message " Add Data Programme"
> DEFINE PAD Admn OF (m.cMenuName) PROMPT '\<Admission' ;
> KEY ALT+A, 'ALT+A'message " New Admisssion & Re Admission"
> DEFINE PAD Trac OF (m.cMenuName) PROMPT '\<Transaction' ;
> KEY ALT+T, 'ALT+T'message " Transaction Data Programme"
> DEFINE PAD repo OF (m.cMenuName) PROMPT '\<Reports';
> KEY ALT+R, 'ALT+R'message " Report Programme "
> DEFINE PAD Reprn OF (m.cMenuName) PROMPT 'Re\<Print' ;
> KEY ALT+P, 'ALT+P'message " Re Print Many Proformas"
> DEFINE PAD exit OF (m.cMenuName) PROMPT 'E\<xit';
> KEY ALT+X, 'ALT+X'message " Quit the system "
>
> ON PAD Mast OF (m.cMenuName) ACTIVATE POPUP adding
> ON PAD Admn OF (m.cMenuName) ACTIVATE POPUP admn1
> ON PAD Trac OF (m.cMenuName) ACTIVATE POPUP Trans
> ON PAD repo OF (m.cMenuName) ACTIVATE POPUP report
> ON PAD Reprn OF (m.cMenuName) ACTIVATE POPUP reprnt
> ON PAD exit OF (m.cMenuName) ACTIVATE POPUP quit
>
> *======= DEFINE FIRST ADDING POPUP
> DEFINE POPUP adding MARGIN RELATIVE SHADOW COLOR SCHEME 4
> DEFINE BAR 1 OF adding PROMPT '\<Add Data'
> DEFINE BAR 2 OF adding PROMPT '\-'
> DEFINE BAR 3 OF adding PROMPT '\<Modify Data'
>
> *======= DEFINE FIRST ADDING POPUP Add Data
> on bar 1 of adding activate POPUP Adata
> DEFINE POPUP Adata MARGIN RELATIVE SHADOW COLOR SCHEME 4
> DEFINE BAR 1 OF Adata PROMPT '\<Transport Charges'
> DEFINE BAR 2 OF Adata PROMPT '\<Fees Structure'
> on Sele popup Adata Do master\prgs\AMst With bar()
> *======= DEFINE FIRST ADDING POPUP Modify Data
> on bar 3 of adding activate popup Mdata
> DEFINE POPUP Mdata MARGIN RELATIVE SHADOW COLOR SCHEME 4
> DEFINE BAR 1 OF Mdata PROMPT '\<Edit Student Bio-Data'
> DEFINE BAR 2 OF Mdata PROMPT '\<Edit Admission Charges'
> on Sele popup Mdata Do master\prgs\DMst With bar()
>
> *======= DEFINE SECOND ADMISSION/RE ADMISSION POPUP
> DEFINE POPUP Admn1 MARGIN RELATIVE SHADOW COLOR SCHEME 4 &&font 'arial',16
> DEFINE BAR 1 OF Admn1 PROMPT '\<New Admission'
> DEFINE BAR 2 OF Admn1 PROMPT '\<Re_Admission'
> ON SELECTION POPUP Admn1 DO master\prgs\second WITH bar()
>
> *======= DEFINE THIRD DEPOSIT FEES TRANSACTION POPUP
> DEFINE POPUP Trans MARGIN RELATIVE SHADOW COLOR SCHEME 4 &&font 'arial',16
> DEFINE BAR 1 OF Trans PROMPT '\<Deposit Fees'
> DEFINE BAR 2 OF Trans PROMPT '\<Refund Fee'
> DEFINE BAR 3 OF Trans PROMPT '\<Leave Student'
> ON SELECTION POPUP Trans DO master\prgs\third WITH bar()
>
> *======= DEFINE FOURTH REPORT/LISTS POPUP
> DEFINE POPUP report MARGIN RELATIVE SHADOW COLOR SCHEME 4 &&font 'arial',16
> DEFINE BAR 1 OF report PROMPT '\<1 Daily Receipts'
> DEFINE BAR 2 OF report PROMPT '\<2 List of All Student/Class Wise'
> DEFINE BAR 3 OF report PROMPT '\<3 List of Transport/City Wise'
> DEFINE BAR 4 OF report PROMPT '\<4 List of Leaving Student'
> DEFINE BAR 5 OF report PROMPT '\<5 List of Concentational'
> DEFINE BAR 6 OF report PROMPT '\<6 List of Pending Fees/Class Wise'
> DEFINE BAR 7 OF report PROMPT '\<7 Strength of Students'
> DEFINE BAR 8 OF report PROMPT '\<8 All & city Wise List'
> DEFINE BAR 9 OF report PROMPT '\<9 Statement of Student'
> ON SELECTION POPUP report DO master\prgs\forth WITH bar()
>
> *======= DEFINE FOURTH RE_PRINT VOUCHER POPUP
> DEFINE POPUP REPRNT MARGIN RELATIVE SHADOW COLOR SCHEME 4 &&font 'arial',16
> DEFINE BAR 1 OF REPRNT PROMPT '\<1 Admission Form Reprint'
> DEFINE BAR 2 OF REPRNT PROMPT '\<2 Receipt Reprint'
> DEFINE BAR 3 OF REPRNT PROMPT '\<3 Birth Certificate'
> DEFINE BAR 4 OF REPRNT PROMPT '\<4 Fees Certificate'
> ON SELECTION POPUP reprnt DO master\prgs\fifth WITH bar()
>
> *======= DEFINE Sixth EXIT POPUP
> DEFINE POPUP QUIT MARGIN RELATIVE SHADOW COLOR SCHEME 4 &&font 'arial',16 color rgb(0,0,255,255,255,,,)
> DEFINE BAR 1 OF QUIT PROMPT '\<Quit to System'
> ON SELECTION POPUP quit DO master\prgs\sixth WITH BAR()
> *-----------------------------------------------------------
> ACTIVATE MENU (m.cMenuName) nowait
> *-----------------------------------------------------------
> IF m.cTypeParm2 = "C"
> m.getMenuName = m.cMenuName
> m.oFormRef.Name = m.cSaveFormName
> ENDIF
>
> * endproc
> *--------------------------------------------------------------------------
> procedure destroy
> *clea events
> endproc
> ENDDEFINE
>
> DEFINE CLASS asup AS toolbar
> ShowWindow = 1
> Caption = "Toolbar1"
> Height = 44
> Left = 103
> Top = 0
> Width = 387
> Name = "asup"
> movable = .f.
>
> ADD OBJECT separator1 AS separator WITH ;
> Top = 3, ;
> Left = 5, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator1"
>
> ADD OBJECT command1 AS commandbutton WITH ;
> Top = 3, ;
> Left = 5, ;
> Height = 58, ;
> Width = 67, ;
> picture = HOME()+"\Graphics\Bitmaps\Offctlbr\small\color\ne.bmp",;
> wordwrap = .t.,;
> caption = "Re Admission",;
> BackColor = RGB(0,255,0), ;
> Name = "Command1"
>
> ADD OBJECT separator2 AS separator WITH ;
> Top = 3, ;
> Left = 44, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator2"
>
> ADD OBJECT command2 AS commandbutton WITH ;
> Top = 3, ;
> Left = 45, ;
> Height = 58, ;
> Width = 67, ;
> Caption = "New Admission", ;
> BackColor = RGB(0,255,0), ;
> wordwrap = .t.,;
> Name = "Command2"
>
> ADD OBJECT separator3 AS separator WITH ;
> Top = 3, ;
> Left = 101, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator3"
>
> ADD OBJECT command3 AS commandbutton WITH ;
> Top = 3, ;
> Left = 95, ;
> Height = 58, ;
> Width = 67, ;
> wordwrap = .t.,;
> Caption = "Deposit Fees", ;
> BackColor = RGB(0,255,0), ;
> Name = "Command3"
>
> ADD OBJECT separator4 AS separator WITH ;
> Top = 3, ;
> Left = 101, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator4"
> ADD OBJECT command4 AS commandbutton WITH ;
> Top = 3, ;
> Left = 140, ;
> Height = 58, ;
> Width = 67, ;
> wordwrap = .t.,;
> Caption = "Daily Receipt", ;
> BackColor = RGB(0,255,0), ;
> Name = "Command4"
> ADD OBJECT separator5 AS separator WITH ;
> Top = 3, ;
> Left = 101, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator5"
> ADD OBJECT command5 AS commandbutton WITH ;
> Top = 3, ;
> Left = 185, ;
> Height = 58, ;
> Width = 67, ;
> Caption = "Pending Fees", ;
> wordwrap = .t.,;
> BackColor = RGB(0,255,0), ;
> Name = "Command5"
> ADD OBJECT separator6 AS separator WITH ;
> Top = 3, ;
> Left = 101, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator6"
> ADD OBJECT command6 AS commandbutton WITH ;
> Top = 3, ;
> Left = 230, ;
> Height = 58, ;
> Width = 67, ;
> Caption = "Statement of Students", ;
> wordwrap = .t.,;
> BackColor = RGB(0,255,0), ;
> Name = "Command6"
> ADD OBJECT separator7 AS separator WITH ;
> Top = 3, ;
> Left = 101, ;
> Height = 0, ;
> Width = 0, ;
> Name = "Separator7"
> ADD OBJECT command7 AS commandbutton WITH ;
> Top = 3, ;
> Left = 230, ;
> Height = 58, ;
> Width = 67, ;
> Caption = "Exit", ;
> wordwrap = .t.,;
> BackColor = RGB(0,255,0), ;
> Name = "Command7"
> procedure init
> this.dock(0)
> this.setall("mousepointer",15,"commandbutton")
>
> PROCEDURE command1.Click
> DO FORM master\form\re_addm
> ENDPROC
>
> PROCEDURE command2.Click
> DO FORM master\form\addm
> ENDPROC
>
> PROCEDURE command3.Click
> DO FORM master\form\fee
> ENDPROC
> PROCEDURE command4.Click
> DO FORM master\form\daily
> ENDPROC
> PROCEDURE command5.Click
> DO FORM master\form\pending
> ENDPROC
> PROCEDURE command6.Click
> DO FORM master\form\statement
> ENDPROC
>
> PROCEDURE command7.Click
> quit
> clear event
> close databases
> ENDPROC
>
>
>
> *Ioform.show
> ENDDEFINE
>
> *!*End Code
>
> *!*End Codents
>
>
> Be Possitive

Rakesh,

Much better, much easier, much faster is to make use of the visual aspects of VFP instead of this trying to create a form by full code.
In the main menu of VFP: File->New select Form and you have a form. Drag and drop all the elements you want on your form.
Likewise you may add a menu VFP: File->New Select Menu choose for either Menu or Shortcut and construct.
Further on in case you realy want to post some code here, please add the HTML codeblogs around it. There is a button on the Foxite mainmenu to do this.
Regards,
Koen

** The coding in VFP without using mDot should be qualified as recreational **

ENTIRE THREAD

Form with Prg file Posted by Rakesh Kumar @ 3/27/2013 5:06:31 PM
RE: Form with Prg file Posted by Koen Piller @ 3/27/2013 6:13:19 PM
RE: Form with Prg file Posted by Rakesh Kumar @ 3/29/2013 3:51:04 AM
RE: Form with Prg file Posted by Koen Piller @ 3/29/2013 9:11:43 AM
RE: Form with Prg file Posted by Stefan Wuebbe @ 3/27/2013 10:56:19 PM