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

Option Group Dumb Question 2

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
VFP 9. OK, I haven't used them in a while. How do i change the width of the captions to show all of my text? I have turned off the auto size on the group, but can't find any properties to set the width of the option captions. Nothing in the builder either. Obviously missing something simple here.

Auguy
Sylvania/Toledo Ohio
 
The optiongroup is a container and it holds 0 to n optionbuttons.
Each optionbutton is an object. Change the width of them. You can use the SETALL() method to change the width of all optionbuttons at once.
To access the optionbuttons in the designer, CTRL+click the optiongroup, or Right click it and choose edit.

Code:
PUBLIC ofrm
ofrm=CREATEOBJECT("MyForm")
ofrm.show()

DEFINE CLASS MyForm as Form
	ADD OBJECT opt as optiongroup WITH buttoncount=2,height=90,width=50+2
	ADD OBJECT lbl as label WITH caption="Use the spinner",autosize=.T.,top=50
	ADD OBJECT spn as spinner WITH top=50,left=100
	PROCEDURE init
		This.opt.buttons[1].Caption="Some text to simulate a long caption"
		This.opt.buttons[2].Caption="Another useless text to simulate a much longer caption"
		ThisForm.opt.setall("Width",50)
		This.spn.Value=This.opt.buttons[1].Width
	ENDPROC
	PROCEDURE spn.interactivechange && use the spinner's up and down atrrows to change the width of optionbuttons
		ThisForm.opt.setall("Width",This.value)
		ThisForm.opt.width=This.value+MAX(ThisForm.opt.buttons[1].left,ThisForm.opt.buttons[2].left)+2
	ENDPROC
ENDDEFINE

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
VFP help optiongroup said:
Option button groups are containers that contain option buttons
As Vilhelm-Ion says any control being a container for all or only for specfic inner controls can be edited in the designer by CTRL+click into it.

VFP help optiongroup said:
frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width
Is given as example to set all inner option buttons of a optiongroup.

In the builder simply "touch" the captions on tab 1 by adding a space and remove it or in the layout tab temporarily change from horizontal to vertical and back, and the group is sized. I see that's not ideal, autosize .t. normally works ok, at least for single labels or option buttons. You could improve it by editing the builders, which are part of xsource within the tools folder.

Bye, Olaf.




 
Thanks to both of you.

Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top