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

How to redefine a class at runtime?

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi!
In my startup.prg there is next class definition
Code:
DEFINE CLASS tbrButton as CommandButton
	HEIGHT 	= 26 * IIF(oApp.FullScreen,SYSMETRIC( 2 ) / 600,1)	
	WIDTH 	= 26 * IIF(oApp.FullScreen,SYSMETRIC( 1 ) / 800,1)
	Fontsize = 9 * IIF(oApp.FullScreen,SYSMETRIC( 2 ) / 600,1)
	caption = ''
ENDDEFINE
The tbrButton class is to create buttons for a toolbar.
oApp.Fullscreen property may change due to user's choice from settings menu.
Is there a way to redefine the class after using oApp.Fullscreen got a new value?

-Bart
 
Bart,

You should be able to change properties like size and font programmatically at runtime.

Regards,
Jim
 

Bart,

Instead of assigning the values to the properties within the class definition, you should add a method to the class, called, say, ResizeButton. This method would change the button's height and width. You then call the method each time the user makes the relevant menu choice.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Following Mike's chain of thought, in VFP 9, once you have a method, you can use BindEvent() to bind to the Windows event of maximizing or restoring the window.

Tamar
 
Thanks to all!
I implemented Mike's solution for now and it works as suspected.
Tamar,
Later on I will use these BindEvents as well.
But for I started mu new framework from scratch in VFP9 it's a long way to go.... <G>
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top