Dynamic object creation  
Author Message
SHISHIR WAHI





PostPosted: Visual FoxPro General, Dynamic object creation Top

Hi!

Is it possible to create an image object at runtime in vfp 8. If yes then can any one tell me how to do it.

Regards,




Visual FoxPro1  
 
 
AndyKr





PostPosted: Visual FoxPro General, Dynamic object creation Top

>> Is it possible to create an image object at runtime in vfp 8

Of course. If you want it on a form just do this:
ThisForm.AddObject( 'oImage', 'image' )

If it is an independent object, then use
oImageRef = CREATEOBJECT( "image" )

Once you have created the object, just set its properties directly:
WITH ThisForm.oImage
.Top = 25
.Left = 50
.Picture = "C:\Graphics\myimage.jpg"
[whatever else you need to set]
.Visible = .T.
ENDWITH

The important one to note is VISIBLE - when you create a new object at run time it is always instantiated with Visible = .F.



 
 
SHISHIR WAHI





PostPosted: Visual FoxPro General, Dynamic object creation Top

Thanks a lot for ur reply. My problem is solved.

Now I've another problem, whenever I use the build button in project manager to build the executable file for my project then for the first time there is no problem but when I run that executable file and then rebuild the executable then there is an error message saying "<my temp folder path>\<filename>.fxp is not closed, please close the file and rebuild the project.". But when I repeate the whole process again then it successfuly builds the exe. Why is it so

Regards,



 
 
AndyKr





PostPosted: Visual FoxPro General, Dynamic object creation Top

Sounds like something is not closing - whatis your ON SHUTDOWN routine doing

Either way, at the command window you can issue "CLOSE ALL" and "CLEAR ALL" commands before doing a build - you really should do that anyway!