Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Classes Design
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01187089
Message ID:
01187538
Views:
24
Thanks for the sample code.

This is what I have.

cCustomCtrls in common\lib folder (visual) - cntBaseDateSelector
aCustomCtrls.prg in app\progs - cntCustomDateSelector, wich uses app controls

I added aCustomCtrls.prg to the Toolbox (Favorites)
I created a test form
I dragged and dropped the cntCustomDateSelector and it works fine. I can see cntCustomDateSelector is using controls from aControls.

The problem that I have is after I do changes to my program class (ctrl-e) then try to open the form. I have this message: "Error instantiating class, cannot find cntCustomDateSelector in aControls" But I can create an isntance of it with no problem in the window command. Once I do that I can open my test form.

Thanks again.

BTW when using the Toolbox the first time, where do you usually create it? I placed it folder under my \common\toolbox folder

>>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