Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Why are my option buttons not lined up vertically ?
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement