Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Classes Design
Message
From
19/01/2007 21:47:37
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01187089
Message ID:
01187294
Views:
16
>I haven't used the Toolbox approach, can you explain? and yes, if you don't mind, I would like to have the sample code.

Here is a short example. It is a two-minutes one, so of course yu'll want to improve it, but the idea is there. Take a look at it and tell me if you get it. Regarding the toolbox, the only think you have to do is to add a class library, and in the open dialog change "VCX" for "PRG". Then you can drag and drop the container into any form.
* Test for William Benavente
* Save it to William.prg and run it (Ctrl+E)

oForm = NewObject("TestForm" )
oForm.show(1)

oForm = NewObject("TestForm", "", "", "YourCustomContainer" )
oForm.show(1)


Define Class TestForm As Form
	
	Autocenter = .t.
	
	Function Init( tcContainer as String  ) as Boolean 
		
		tcContainer = Iif( Empty(tcContainer), "YourBaseContainer", tcContainer )
		this.Caption = "Container: " + tcContainer
		
		this.NewObject( "testContainer", tcContainer, "William.prg" )
		this.testContainer.visible = .t.
EndDefine 



Define Class YourBaseContainer As Container
	
	Width = 200
	Height = 30
	
	cLabelMember = "Label"
	cLabelMemberClass = ""
	cTextMember = "Textbox"
	cTextMemberClass = ""

	Function Init()
		this.NewObject( "lblMember", this.cLabelMember, this.cLabelMemberClass )
		this.NewObject( "txtMember", this.cTextMember, this.cTextMemberClass )
		
		this.lblMember.Width = 80
		this.lblMember.Caption = "Something"
		this.lblMember.Visible = .t.
		this.txtMember.Left = 100
		this.txtMember.Width = 80
		this.txtMember.Visible = .t.
	EndFunc 
	
Enddefine

Define Class YourCustomContainer As YourBaseContainer 
	cLabelMember = "CustomLabel"
	cLabelMemberClass = "William.prg"
	cTextMember = "CustomTextbox"
	cTextMemberClass = "William.prg"
Enddefine

Define Class CustomLabel As Label
	ForeColor = Rgb(255,0,0)
Enddefine

Define Class CustomTextBox As TextBox
	BackColor = Rgb(0,255,255)
Enddefine
Take a look at it and ask me what you need. I'll be back here on Sunday night.

Have a nice weekend!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform