Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: sanjay karia
  Where is sanjay karia?
 mumbai
 India
 sanjay karia
 To: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 Tags
Subject: RE: do while in define class
Thread ID: 228280 Message ID: 228353 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Monday, May 18, 2009 12:42:56 PM         
   


Thanks Stefan,
You have been helpful, as always.
It solved my problem.

Initially I was doubtful whether I will be able to use Define Class Prg style. But I find it very good & not so difficult. I Should use it frequently.

Thanks again for your help.
Regards

> > Thanks Ammar,
> > It worked, now more help required.
> >
> > 1. How can I add validations for commandbuttons, mouseevents for container, How can I use validation for commandbutton1 & mouseleave in container2 in for..next
> > 2. How to add method/property
> >
>
> In addition to what the others already said: you cannot add code at runtime (WriteMethod() works at design-time only, see also the "Builders" chapter in help).
> Or better, you can use ExecScript() and ¯o substitutions, but you may rarely want to do so.
> Instead, defining classes containing generic code works better, either in a PRG (Define Class style) or in a visual VCX class.
> FWIW, personally I am using Define Class PRG style a lot, but rather to get demo code. In a real project, I prefer the visual designers for visual classes, especially for complex container-ship things.
>
> > Pls check my code..
> >
>
>
>
> LOCAL oForm as Form
> oForm = CREATEOBJECT('TestForm')
> oForm.Show(1)
> RETURN
> 
> DEFINE CLASS TestForm as Form
> 	AutoCenter = .T.
> 	PROCEDURE Init
> 		LOCAL i, c, o
> 		FOR i = 1 TO 3
> 			c = 'Container' + TRANSFORM(i)
> 			This.AddObject(c,'TestContainer')
> 			o = GETPEM(This,c)
> 			WITH o as Container
> 				.Move(50*i, 50*i)
> 				* .WriteMethod('Click','MessageBox(LOWER(PROGRAM()))')
> 					&& WriteMethod does not work at runtime
> 					&& Better Define a separate class containing "generic" code instead
> 				.Visible = .T.
> 			ENDWITH
> 		ENDFOR
> 	ENDPROC
> 
> ENDDEFINE
> 
> DEFINE CLASS TestContainer as Container
> 	PROCEDURE Click
> 		MESSAGEBOX(LOWER(PROGRAM()))
> 	ENDPROC
> ENDDEFINE
> 


ENTIRE THREAD

do while in define class Posted by sanjay karia @ 5/17/2009 9:42:29 PM
RE: do while in define class Posted by Ammar Hadi @ 5/17/2009 10:27:54 PM
RE: do while in define class Posted by sanjay karia @ 5/18/2009 7:42:37 AM
RE: do while in define class Posted by Anders Altberg @ 5/18/2009 10:08:45 AM
RE: do while in define class Posted by Stefan Wuebbe @ 5/18/2009 10:18:59 AM
RE: do while in define class Posted by sanjay karia @ 5/18/2009 12:42:56 PM
RE: do while in define class Posted by Stefan Wuebbe @ 5/18/2009 3:30:21 PM
RE: do while in define class Posted by Glen Villar @ 5/18/2009 4:26:24 AM
RE: do while in define class Posted by sanjay karia @ 5/18/2009 7:45:12 AM
RE: do while in define class Posted by tushar @ 5/18/2009 7:32:14 AM
RE: do while in define class Posted by sanjay karia @ 5/18/2009 7:46:21 AM