good afternoon,
bear me, new vba. have sub opens text box when double clicked, not want open text box (expands it), want run sub called emspull. works except fact want double click close textbox without running emspull again.
also, can explain "control", situation (i didnt write adjustheight )
code below
private sub txtems_dblclick(byval cancel msforms.returnboolean) call adjustheight(txtems, lblems) call emspull end sub public sub adjustheight(ccontrol control, clabel control) on error goto errhand if bexpandedmode = false doldtop = ccontrol.top doldleft = ccontrol.left doldwidth = ccontrol.width doldheight = ccontrol.height ccontrol.top = lbldescription.top + 50 ccontrol.width = ccontrol.width * 2 ccontrol.height = 500 ccontrol.left = lblresults.left bexpandedmode = true call hidealltxt(ccontrol) lbldescription.visible = true lbldescription.caption = clabel.caption if len(ccontrol.text) > 2 ccontrol.curline = 0 end if else bexpandedmode = false call showalltxt lbldescription.visible = false ccontrol.top = doldtop ccontrol.left = doldleft ccontrol.width = doldwidth ccontrol.height = doldheight end if exit sub errhand: resume next end sub
i'm assuming have global boolean named bexpandedmode @ top of subs? if should work fine:
private sub txtems_dblclick(byval cancel msforms.returnboolean) call adjustheight(txtems, lblems) if bexpandedmode = true call emspull 'calls when expanded in adjustheight end sub public sub adjustheight(ccontrol control, clabel control) on error goto errhand if bexpandedmode = false doldtop = ccontrol.top doldleft = ccontrol.left doldwidth = ccontrol.width doldheight = ccontrol.height ccontrol.top = lbldescription.top + 50 ccontrol.width = ccontrol.width * 2 ccontrol.height = 500 ccontrol.left = lblresults.left bexpandedmode = true call hidealltxt(ccontrol) lbldescription.visible = true lbldescription.caption = clabel.caption if len(ccontrol.text) > 2 ccontrol.curline = 0 end if else bexpandedmode = false call showalltxt lbldescription.visible = false ccontrol.top = doldtop ccontrol.left = doldleft ccontrol.width = doldwidth ccontrol.height = doldheight end if exit sub errhand: resume next end sub
basically if boolean exists , used think is, check whether box expanded right or not. when it's not, boolean false, , adjustheight expands it, turns true. conversely when set true, closes instead, , sets false.
so fix checks same boolean , runs 1 way (when expanded)
Comments
Post a Comment