Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why are my option buttons not lined up vertically ?
Message
From
30/01/2001 11:50:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Why are my option buttons not lined up vertically ?
Miscellaneous
Thread ID:
00470128
Message ID:
00470128
Views:
282
I am using addobject() at runtime to programmatically add option buttons to an option group. The buttons are not lining up vertically. As each successive button is added, it moves to the left about this much ' ' (width of button?), relative to the previous one. buttons look like this

*
*
*
*


here is the code:

(note I have added some wacky code to try to counteract the problem - adjusting the left property with leftctr - but it is still screwy - it helps but now the buttons end up like this

*
*
*
*
roughly

*elect * from surans where surans.cq
local lnresult
lnresult=amembers(aoptobjects,thisform.pgfsurvey.page5.optanswers, 2)
*for i= 1 to thisform.pgfsurvey.page5.optanswers.buttoncount
* thisform.pgfsurvey.page5.optanswers.removeobject(i)
*endfor
if lnresult <> 0
for i= 1 to alen(aoptobjects)
thisform.pgfsurvey.page5.optanswers.removeobject(aoptobjects[i])
endfor
endif

select surans
set filter to surans.csurqno= surques.csurqno
go top
lnctr=0
topcntr=-15
leftcntr=-2
do while not eof()
lnctr=lnctr+1
topcntr=topcntr+25
leftcntr=leftcntr+2

lcobjname='opt' + alltrim(str(lnctr))
thisform.pgfsurvey.page5.optanswers.addobject(lcobjname,'optionbutton')
thisform.pgfsurvey.page5.optanswers.&lcobjname..autosize = .t.
thisform.pgfsurvey.page5.optanswers.&lcobjname..alignment = 0
thisform.pgfsurvey.page5.optanswers.&lcobjname..left = 5 + leftcntr
thisform.pgfsurvey.page5.optanswers.&lcobjname..top=topcntr
thisform.pgfsurvey.page5.optanswers.&lcobjname..caption = alltrim(surans.cansans)
wait wind STR(thisform.pgfsurvey.page5.optanswers.&lcobjname..LEFT)

skip
enddo
lnresult=amembers(aoptobjects,thisform.pgfsurvey.page5.optanswers, 2)
*for i= 1 to thisform.pgfsurvey.page5.optanswers.buttoncount
* thisform.pgfsurvey.page5.optanswers.removeobject(i)
*endfor
if lnresult <> 0
for i= 1 to alen(aoptobjects)
lcobjectname=aoptobjects[i]
thisform.pgfsurvey.page5.optanswers.&lcobjectname..visible=.t.
endfor
endif


*thisform.pgfsurvey.page5.optanswers.&lcobjname..visible = .t.
thisform.pgfsurvey.page5.optanswers.visible=.t.

thisform.refresh()


******************************
any ideas ?

thanks

David Schlesinger
Next
Reply
Map
View

Click here to load this message in the networking platform