Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resize an option group
Message
From
31/03/2008 15:53:20
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01306572
Message ID:
01307114
Views:
12
>>How do you resize a custom optiongroup?
>>I have a custom optiongroup as a standard base class. The buttons within the optiongroup have been replaced with custom subclassed buttons.
>>
>>My forms typically scale themselves to fit the screen resolution. The init event of each control contains "thisform.resizeobject(this)" to perform this scaling. This has always worked fine except that now with the 22inch monitors I can't get the optiongroup to scale properly.
>>
>>I have tried various combinations of the resize code in the base group and in the individual buttons. Also a for each loop in the parent to resize the option buttons. My immediate group contains 4 buttons. Depending on how I have coded it, I get either the first 2 or the last 2 buttons properly resized, but never all 4 uniformly. Sometimes I get all 4 fonts adjusted but not the positions. I also note that the first 2 buttons inherit their init code while the additional ones do not. So I tried placing the resize code directly into the last 2 buttons but that did not work either.
>>
>>Probably I missed something when I defined the custom class, but what?
>>
>>Any help appreciated.
>>Thanks
>
>How many buttons do you have in your class? As John said, can you post your code for the class (open the library in the class browser, go to view code and copy relevant piece)?

Here you go :)
**************************************************
*-- Class:        df_optiongroup (d:\foxpro\classes\df_base.vcx)
*-- ParentClass:  optiongroup
*-- BaseClass:    optiongroup
*-- Time Stamp:   08/16/07 08:33:04 AM
*
DEFINE CLASS df_optiongroup AS optiongroup
	AutoSize = .T.
	MemberClassLibrary = "df_base.vcx"
	MemberClass = "df_optionbutton"
	ButtonCount = 2
	Value = 0
	Height = 46
	Width = 71
	*-- Authlevel needed to access this control
	authorization = 1
	Name = "df_optiongroup"
	Df_optionbutton1.Left = 5
	Df_optionbutton1.Top = 5
	Df_optionbutton1.Name = "Df_optionbutton1"
	Df_optionbutton2.Left = 5
	Df_optionbutton2.Top = 24
	Df_optionbutton2.Name = "Df_optionbutton2"

	PROCEDURE Init
		thisform.resizeobject(this)
		*	for each loOpt in this.Buttons
		*	thisform.resizeobject(loOpt)
		*	next
	ENDPROC
ENDDEFINE
*
*-- EndDefine: df_optiongroup
**************************************************
And here's the single button.
**************************************************
*-- Class:        df_optionbutton (d:\foxpro\classes\df_base.vcx)
*-- ParentClass:  optionbutton
*-- BaseClass:    optionbutton
*-- Time Stamp:   08/16/07 08:33:00 AM
*
DEFINE CLASS df_optionbutton AS optionbutton
	Caption = "Option1"
	Height = 17
	Width = 61
	AutoSize = .T.
	*-- Authorization level needed to activate this control.
	authorization = 1
	Name = "df_optionbutton"
	PROCEDURE Init
		thisform.resizeobject(this)
		if authlevel < this.authorization
		this.enabled = .f.
		endif
	ENDPROC
ENDDEFINE
*
*-- EndDefine: df_optionbutton
**************************************************
I've tried it with the commented lines active and several other combinations.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform