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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Define Class

Status
Not open for further replies.

Thmemuar

Programmer
Sep 23, 2002
8
CA
I want to programmatically create a custom class (MYFORM) based on FORM, so I can use it instead of FORM.

More importantly, I want to be able to add a property that doesn't exist in FORM (say, NeverUsed) that may be either .T. or .F. (in this case the default should be .T.).

Also, I want to change the default settings of an existing property (ShowWindow) to 2.

All this, so that I can use oForm = CREATEOBJECT("MYFORM") and the just-created will have my new property NeverUsed = .T. and the existing property ShowWindow with a value of 2.

Is that possible, because I can't seem to get it to work...

Thanks.
 
Try this :
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	Neverused = .F.
ENDDEFINE
Mike Gagnon

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

**************************************************
*-- Class: formbase
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 09/04/02 12:05:08 AM
*
DEFINE CLASS formbase AS form

Height = 408
Width = 600
DoCreate = .T.
ShowTips = .T.
AutoCenter = .T.
Caption = "BaseForm"
Closable = .T.
MinButton = .F.
MDIForm = .T.
Icon = "..\icons\note04.ico"
WindowType = 1
WindowState = 0
AlwaysOnTop = .F.
Name = "formbase"
lNeverUsed = .t.

** Just a tricky thing... double click on the form and see
PROCEDURE DblClick
WITH ThisForm
IF .Width < 641
.Width = 760
.Height = 528
ELSE
IF .WindowState = 2
.Width = 600
.Height = 408
ELSE
.WindowState = 2
ENDIF
ENDIF
.AutoCenter = .t.
ENDWITH
ENDPROC

ENDDEFINE
*
*-- EndDefine: formbase
**************************************************
:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top