Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditionally moving / aligning form objects
Message
 
To
22/01/2017 17:13:18
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01646942
Message ID:
01646945
Views:
51
Wow. Thank you very much. I will give it a try. I will have to perhaps put the checkboxes in a container and spin thru that, to replicate what you have done here w/ the optiongroup control. Thanks.

>simply recurse on all buttons of optiongroup and recalculate each top by eliminating that whose invisible.
>if button option is disabled(enabled=.f.) make it visible=.f. (if dont want to see it)
>this is a test form for this solution (15 options : some options are invisible,another are disabled..)
>can rearrange the optionGroup dynamically from the relative button.
>
>publi oform
>oform=newObject("asup")
>oform.show
>read events
>retu
>*
>DEFINE CLASS asup AS form
>	BorderStyle = 0
>	Top = 0
>	Left = 45
>	Height = 312
>	Width = 276
>	ShowWindow = 2
>	Caption = "Form1"
>	MaxButton = .F.
>	BackColor = RGB(212,210,208)
>	Name = "Form1"
>
>	ADD OBJECT optiongroup1 AS optiongroup WITH ;
>		AutoSize = .T., ;
>		ButtonCount = 15, ;
>		BackStyle = 0, ;
>		BorderStyle = 0, ;
>		Value = 1, ;
>		Height = 293, ;
>		Left = 28, ;
>		Top = 11, ;
>		Width = 78, ;
>		Name = "Optiongroup1", ;
>		Option1.Caption = "Option1", ;
>		Option1.Value = 1, ;
>		Option1.Height = 17, ;
>		Option1.Left = 5, ;
>		Option1.Top = 5, ;
>		Option1.Width = 61, ;
>		Option1.Name = "Option1", ;
>		Option2.Caption = "Option2", ;
>		Option2.Enabled = .F., ;
>		Option2.Height = 17, ;
>		Option2.Left = 5, ;
>		Option2.Top = 24, ;
>		Option2.Width = 61, ;
>		Option2.Name = "Option2", ;
>		Option3.Caption = "Option3", ;
>		Option3.Height = 17, ;
>		Option3.Left = 5, ;
>		Option3.Top = 43, ;
>		Option3.Width = 61, ;
>		Option3.Name = "Option3", ;
>		Option4.Caption = "Option4", ;
>		Option4.Height = 17, ;
>		Option4.Left = 5, ;
>		Option4.Top = 62, ;
>		Option4.Width = 61, ;
>		Option4.Name = "Option4", ;
>		Option5.Caption = "Option5", ;
>		Option5.Height = 17, ;
>		Option5.Left = 5, ;
>		Option5.Top = 81, ;
>		Option5.Visible = .F., ;
>		Option5.Width = 61, ;
>		Option5.Name = "Option5", ;
>		Option6.Caption = "Option6", ;
>		Option6.Height = 17, ;
>		Option6.Left = 5, ;
>		Option6.Top = 100, ;
>		Option6.Visible = .F., ;
>		Option6.Width = 61, ;
>		Option6.Name = "Option6", ;
>		Option7.Caption = "Option7", ;
>		Option7.Height = 17, ;
>		Option7.Left = 5, ;
>		Option7.Top = 119, ;
>		Option7.Width = 61, ;
>		Option7.Name = "Option7", ;
>		Option8.Caption = "Option8", ;
>		Option8.Height = 17, ;
>		Option8.Left = 5, ;
>		Option8.Top = 138, ;
>		Option8.Visible = .F., ;
>		Option8.Width = 61, ;
>		Option8.Name = "Option8", ;
>		Option9.Caption = "Option9", ;
>		Option9.Height = 17, ;
>		Option9.Left = 5, ;
>		Option9.Top = 157, ;
>		Option9.Width = 61, ;
>		Option9.Name = "Option9", ;
>		Option10.Caption = "Option10", ;
>		Option10.Height = 17, ;
>		Option10.Left = 5, ;
>		Option10.Top = 176, ;
>		Option10.Width = 68, ;
>		Option10.Name = "Option10", ;
>		Option11.Caption = "Option11", ;
>		Option11.Height = 17, ;
>		Option11.Left = 5, ;
>		Option11.Top = 195, ;
>		Option11.Width = 68, ;
>		Option11.Name = "Option11", ;
>		Option12.Caption = "Option12", ;
>		Option12.Height = 17, ;
>		Option12.Left = 5, ;
>		Option12.Top = 214, ;
>		Option12.Width = 68, ;
>		Option12.Name = "Option12", ;
>		Option13.Caption = "Option13", ;
>		Option13.Enabled = .F., ;
>		Option13.Height = 17, ;
>		Option13.Left = 5, ;
>		Option13.Top = 233, ;
>		Option13.Width = 68, ;
>		Option13.Name = "Option13", ;
>		Option14.Caption = "Option14", ;
>		Option14.Height = 17, ;
>		Option14.Left = 5, ;
>		Option14.Top = 252, ;
>		Option14.Width = 68, ;
>		Option14.Name = "Option14", ;
>		Option15.Caption = "Option15", ;
>		Option15.Enabled = .F., ;
>		Option15.Height = 17, ;
>		Option15.Left = 5, ;
>		Option15.Top = 271, ;
>		Option15.Width = 68, ;
>		Option15.Name = "Option15"
>
>	ADD OBJECT command4 AS commandbutton WITH ;
>		Top = 12, ;
>		Left = 120, ;
>		Height = 27, ;
>		Width = 84, ;
>		Caption = "Arrange", ;
>		Name = "Command4"
>
>	PROCEDURE Destroy
>		clea events
>	ENDPROC
>
>	PROCEDURE command4.Click
>		create cursor ycurs (num i)
>
>		with thisform.optionGroup1
>
>		for i=1 to .buttonCount
>		if .buttons(i).enabled=.f.
>		.buttons(i).visible=.f.
>		endi
>
>		if .buttons(i).visible=.t.
>		insert into ycurs values (i)
>		endi
>		endfor
>		*brow
>
>		local m.xtop,m.rec,m.num0
>		m.xtop=10
>		local m.xspace
>		m.xspace=2    &&spacing between 2 options
>
>		sele ycurs
>		scan  
>		rec=recno()
>		if m.rec=1
>		.buttons(num).top=xtop
>		else
>		go m.rec-1
>		m.num0=num
>		go rec
>		.buttons(num).top=.buttons(m.num0).top+.buttons(m.num0).height+m.xspace
>		endi
>		endscan
>
>		endwith
>	ENDPROC
>
>ENDDEFINE
>*
>*-- EndDefine: asup
>
Previous
Reply
Map
View

Click here to load this message in the networking platform